Home >Web Front-end >JS Tutorial >How to deal with the problem that ajax access cannot be refreshed in IE8

How to deal with the problem that ajax access cannot be refreshed in IE8

php中世界最好的语言
php中世界最好的语言Original
2018-04-04 10:29:291418browse

This time I will bring you a solution to the problem that ajax access cannot be refreshed in IE8. What are the things to note when dealing with ajax access that cannot be refreshed in IE8? The following is a practical case, let’s take a look.

Introduction to AJAXAJAX = Asynchronous

JavaScript

and XML (Asynchronous JavaScript and XML ). AJAX is not a new

programming language

, but a new way of using existing standards. AJAX is the art of exchanging data with a server and updating parts of a web page without reloading the entire page.

The problem that IE8 cannot be refreshed every time using ajax is introduced as follows: I recently discovered that using ajax to access the background and ie8 to access, The value can be returned normally for the first time, and the background will not be executed thereafter, and the result of the first access will always be returned.

There is no problem with ie9, ie10, etc., there is no problem with chrome, other browsers.

After testing, it was found that ie8 cached the result obtained for the first time, so it would not be submitted to the background the second time.

Add a random number after the ajax request to make each request inconsistent, and ie will not obtain the results from the cache.

For example, after the ajax request, add "....&random=" +Math.random(); so that each request is inconsistent and ie will not fetch the results from the cache.

I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

How Ajax’s restful interface transmits Json data


How ajax implements the encapsulation of network requests

The above is the detailed content of How to deal with the problem that ajax access cannot be refreshed in IE8. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn