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