2009年4月13日 星期一

jQuery AJAX on IE does not reflesh

If you use jQuery to implement the AJAX functionality, especially use the "get", "getJSON" and "load", would you encounter one problem on IE, "Ajax" does not really call backend link, but return value immediately".

The problem is the cache of IE. If we use "Get" method to get data from backend, and the parameters are the same, IE won't really get the data. In contrast, FF does not have this problem. The solution is to set cache to false.


$.ajaxSetup({cache: false});
$.get("xxx.jsp",{A=a,B=b},function(){

});


Or, add a parameter with date.

$.get("xxx.jsp",{timestamp:new Date().getTime()},function(){

});

1 則留言:

匿名 提到...

$.ajaxSetup({cache: false});
Works for me

but add parameter didn't work

Anyway, thanks a lot! ^_^