A strange problem, in the use of Ajax submitted when the return value assigned to a variable, no matter how to write a value, just start to suspect JS error but IE did not respond, many times clear the cache, the Ministry of Procedures have no effect ... The last line of alert was to see where the cause was, and the strange thing was that when alert was added, the value could be assigned, and the deletion of alert would not be possible. Baidu was found to be because Ajax default is asynchronous execution, that is, and did not wait for the completion of the request to start execution of the next line of JS statement, resulting in the assignment is null.
If you encounter an AJAX request with a callback function such as a problem to add async:false, note that if the false plus quotes is not a problem.
Copy Code code as follows:
$.ajax ({
Async:false
})