开发者

weird IE7 $.getJSON ajax call

I'm using $.getJSON to execute an ajax call to the latest database update. Chrome and Firefox work fine, but IE7 when using IE7, the ser开发者_开发问答ver will response the first update I have since I clear IE7 cache.

Any ideas?


could use $.ajax instead with these options.. notice 'cache: false':

$.ajax({
  url: url,
  dataType: 'json',
  cache: false,
  data: data,
  success: callback
});

see : http://api.jquery.com/jQuery.ajax/


I have experienced this before. You would want to add a new parameter that is different everytime. Something like this:

var ts = new Date().getTime(); //get the current timestamp
//add the ts as a parameter to your call along with all your other data. 

This way every request is different and IE wont cache it.


IE has this bad habit of caching responses to AJAX calls.

Add a dummy parameter to your query string that changes each time you make the AJAX call, and then you'll get fresh results.

Update: If you use Mootools, then you can have this done automatically. Look for the noCache option.


This is an issue withthe cache, where IE Caches your data so that the latter calls do not get the results from the server but within the IE Cache

If your using jQuery for all your ajax then you should run this first:

$.ajaxSetup({
  cache: false
});

If set to false, it will force requested pages not to be cached by the browser.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜