A problem occurs in the project. Under Firefox, $. getJSON (); The request data is normal, but in IE, $. getJSON (); only requests data once. The second request is not sent at all. It is known that it was captured by fiddler. If the second request is not sent, it will be normal if it is changed to post.
$. GetJSON () has a cache problem. If the called url has been called before, the callback function will directly obtain the desired value in the cache instead of entering the background.
The solution is as follows:
1. Make the URLs of each call different.
Method: Add a random number to the parameter.
Copy codeThe Code is as follows:
$. GetJSON ("/Member/GetExercise.html", {id: $ ("# Wareid"). val (), isBool: loop, random:
Math. random ()}, function (data )});
Copy codeThe Code is as follows:
$. GetJSON ("/Member/GetExercise.html? Random = Math. random ", {id: $ (" # Wareid "). val (),
IsBool: loop,}, function (data )});
Using new Date () is also a random URL.
Copy codeThe Code is as follows:
? Random = new Date (). getTime ()
2. Set the cache to false.
Copy codeThe Code is as follows:
$. Ajax ({
Type: "GET ",
Url: '/Member/GetExercise.html ',
Cache: false,
DataType: "json ",
Success: function (data ){
Alert (data );
}
});