Problems with Get encountered:
1. Question one. Caching: When each access URL is the same, the client directly reads the contents of the local cache, even if the background data changes the foreground will not change;
Solution: In? The following link is a num= "random number Math.random ()" or num= "timestamp new Date (). GetTime ()", ' 1.php?username= ' May ' & ' +num (there are no variable names here, avoid conflicts with background parameters)
2. Question two. Garbled, when the transmission of Chinese or special characters, the foreground appears garbled
Solution: Using coded encodeURI (' snail ')
Test results: By using the chrome test, both problems with the result get have been solved
Issues encountered using Post:
Post method, the data is placed in the Send () as a parameter transfer;
Problem: When the request header is not set, the background directly does not process the data, the foreground will not be able to obtain background data returned
Workaround: Manually set the request header (Xhr.setrequestheader (' Content-type ', ' application/x-www-form-urlencoded ')) to declare the data type sent
"Note" Post does not have a caching problem, there is no coding problem (because it has been declared in the request header)
Test results: By using the chrome test, the result post this does not declare the header information, the problem exists
The above is a small series for everyone on the Ajax get and post the use of the full content of the problem, I hope that we support the cloud-Habitat Community ~