There are several way to resolve AJAX Cache Issue:
In server side, we can add this one:
header(“Cache-Control: no-cache, must-revalidate”);
When sending AJAX request, we can add:
anyAjaxObj.setRequestHeader(“If-Modified-Since”,“0”);
When sending AJAX request, we can add:
anyAjaxObj.setRequestHeader(“Cache-Control”,“no-cache”);
Add new parameter after
URL, for example:
“?fresh=” + Math.random();
or “?timestamp=” + new Date().getTime();
Use “post” instead of “get”. It is not recommended.
===
For jquery:
$.ajax(
cache: false,
url: 'http://myurl',
data: {}
);
This will work for this particular request. If you want to expand the scope of this setting to all AJAX requests, you can set it on the global AJAX configuration:
$.ajaxSetup({ cache: false });