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: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 _(:з ∠)_.