When you perform the serinterval operation on AJAX, you must add a timestamp after the request address.
Because access to the same URL in a short time will access the cache.
VaR interval =Window. setinterval(Function (){
$. Get (".../ajax/calculatetime. aspx? Time = "+ new date (). getmilliseconds (),
{Aid: Aid },
Function (data, status ){
........................................ .......
})
},1000 );
I reprinted a question about Ajax caching.Article
Recently I have been working on projects and have encountered cache problems. TIPS. Because the basic requirement is that IE is compatible with Firefox browsers, Firefox has been used for testing and no cache problems have been found. The cache problem occurs in IE.
If the $. for Ajax () method, it is very easy to remove the cache. You only need to configure the cache attribute to false, but if you want to write getjson () in a simple way (), the configuration cannot be used to remove the cache. Because getjson does not have this cache attribute for you to configure. If the called URL is the same as the previous one, the callback function will read data directly in the cache instead of calling the corresponding method in the background.
Knowing the cause, the solution is to make the URL address of each request different, but it does not affect the data required by the requested service, there are several methods:
1. $. getjson ("url? T = "+ new date (), function (JSON) {}); adds a time variable based on the original URL, and the request address is different each time.
2. $. getjson ("url? Rand = "+ math. random, function (JSON) {}); adds a random variable to the original URL. However, this method is risky. In case the random number is the same ......
3. The third method is to define an incremental variable. Add this variable after the URL. After each request is complete, the variable increments accordingly.
$. Get () the cache removal method is the same as $. getjson ().
Reference blog: http://user.qzone.qq.com/935937284/blog/1329985097