Home > Web Front-end > JS Tutorial > body text

Solution to datagrid failure to reload under IE in EasyUI_jquery

WBOY
Release: 2016-05-16 16:10:41
Original
1362 people have browsed it

Question

I recently used EasyUI to develop a backend system, and found a strange problem during testing. $('dg').datagrid('reload'); When reloading table data, IE did not respond at all. Later I found out that it was not that there was no response, but that the browser used cache.

Solution

The solutions summarized by online netizens include the following:

1. Add a timestamp after the URL to make the URL accessed during the first load and reload inconsistent, making the system unable to use IE cache. Through testing, it was found that EasyUI already comes with a string of random numbers_145232xxx when making requests, but IE still uses cache. Later, I added rand=xxx (random number generated by Math.rand()) to the URL in the requested js and the cache would not be used. (I tested from ie8 to ie11)

2. Use something like adding to to clear the cache:

Copy code The code is as follows:




Unfortunately, like many netizens, I also failed with this method. :(

3. Declare the method corresponding to the datagrid's load as 'POST'. This solution is the fastest. But there are a few questions:
•If the server interface does not support the POST method, it will be discontinued.
•If the server interface can be controlled by itself, this kind of compromise for the front end will result in the interface not being RESTful at all! You must know that the design of RESTful interfaces for queries is basically GET.

Summary

So the first method is to add random numbers to the URL yourself. Forgive me for my code obsessiveness and I don’t want to change the server interface _(:з ∠)_.

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!