Home >Web Front-end >JS Tutorial >Ajax caching problems and solutions under IE8
AJAX stands for "Asynchronous Javascript And XML" (asynchronous JavaScript and XML), which refers to a web development technology for creating interactive web applications. Next, this article will introduce to you the Ajax cache problem and solution under IE8. Let’s take a look at it
Introduction to Ajax
AJAX means “Asynchronous "Javascript And XML" (asynchronous JavaScript and XML) refers to a web development technology for creating interactive web applications.
AJAX = Asynchronous JavaScript and XML (a subset of Standard Universal Markup Language).
AJAX is a technology for creating fast, dynamic web pages.
By exchanging a small amount of data with the server in the background, AJAX can enable asynchronous updates of web pages. This means that parts of a web page can be updated without reloading the entire page.
The code below works fine in other browsers, but strange problems occur in IE8.
$.ajax({ url:dataUrl, data:encodeURI(currentjsonform), dataType:'JSON', success:function(item){ debugger; .... } });
After careful investigation, it turned out to be an ajax cache problem in IE8. Damn it, when the execution reaches this point, in fact, it does not access our background code, but uses the previously cached results. When debugging in the background, there is no response, and I found out that this is the problem! ! ! ! IE8 is willing to drop.
But the strange thing is that there are many places with such code. Why is it cached only here and not in other places?
Solution:
$.ajaxSetup({ cache: false });2. Parameters plus attributes: cache: false
$.ajax({ url:dataUrl, data:encodeURI(currentjsonform), dataType:'JSON', cache:false, success:function(item){ debugger; .... } });3. You can also add it after the url Timestamp and other methods.
Lesson:
$.ajaxSetup({ cache: false });In fact, the path has a timestamp Or the random number method is sometimes unreliable! Maybe the browser ignores it. Anyway, IE8 has encountered the situation where the URL with timestamp fails many times.
Ajax cache problem under IE8/IE9
IE8 cannot be refreshed every time using ajax access Problem
Quick solution to Ajax submission garbled code under IE
The above is the detailed content of Ajax caching problems and solutions under IE8. For more information, please follow other related articles on the PHP Chinese website!