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

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: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.