An odd question. Using Ajax commits must alert to assign a value

Source: Internet
Author: User

In the use of Ajax to submit the return value to a variable, no matter how to write can not be assigned, just started to suspect JS error but IE did not respond, many times clear cache, the Ministry of the program has no effect

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. The code is as follows: $.ajax ({async:false})
Related Article

E-Commerce Solutions

Leverage the same tools powering the Alibaba Ecosystem

Learn more >

Apsara Conference 2019

The Rise of Data Intelligence, September 25th - 27th, Hangzhou, China

Learn more >

Alibaba Cloud Free Trial

Learn and experience the power of Alibaba Cloud with a free trial worth $300-1200 USD

Learn more >

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.