Solution to the cache problem of Ajax unable to refresh data under IE9

Time:2021-4-17

Use getjson of jQuery to get data from the background regularly and refresh the interface. When using the following methods, it’s OK in chrome and Firefox, but it can’t refresh the data in IE9


$.getJSON(webApp + "/GetShowData.do?limit=" + limit,function(data){
  //******************
}

The reason is that in IE9, if the Ajax request is the same as the previous request, the data will not be obtained from the browser, but directly from the local. Therefore, if you add a timestamp to the request, IE9 will consider it a different request. The code is as follows:


$.getJSON(webApp + "/GetHccShowData.do?" + <span style="color: #ff0000;">new Date().getTime()</span> + "limit=" + Hcc.limit,function(data){
  //******************
}