How to set up a synchronization for Ajax function execution order problems in jquery

Source: Internet
Author: User

This article mainly introduced jquery in the AJAX function execution order question How to set up the synchronization, needs the friend to be possible to refer to under

The JavaScript code codes are as follows: function existproduct (obj) {var ProductName = Escape (Obj.val ()); $.getjson ("..  /product/searchproductbyname.action ", datat,function (data) {var falg;  Falg = data[0][' existproduct '];  Falg returns to No or Yes, return falg;    });  function Validateform () {//alert (Existproduct ($ ("#products_name"));  if (Validatenotnull ($ ("#products_name")) {if (Existproduct ("#products_name")) {$ ("#productform"). Submit ();  }else{$ ("#spanproduct"). HTML ("Business name already exists");  }}else{$ ("#spanproduct"). HTML ("Business name cannot be empty"); In this existproduct (obj) function, I invoke the Getjson function in jquery to return the results of the lookup in the database, which should have no problem with firebug, which is outrageous when the code executes the return FALG, And then execute Getjson, please the Master of the guidance
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.