Problem description: Want to implement click button, appear Blockui layer, and then enter information, click OK, close Blockui, and then invoke Ajax method, but each time to wait until the Ajax execution, the Blockui will be closed, the following method
Start Order Sync
function Syncorder () {
Verifying an empty serial number
var Emptycardid = $ ("#emptyCardId"). Val ();
if (emptycardid== "| | emptycardid==null) {
Alert ("Please enter an empty serial number. ");
return false;
}else{
Closeblockdiv ();
}
$ ("#syncLoadImg"). Show ();
$ ("#syncOrderBtn"). Hide ();
$.ajax ({
Type: "Post",
URL: "${root}/orderprocessjson/syncorder.action",
Data: "Emptycardid=" +emptycardid,
DataType: "JSON",
Async:false,
Success:function (JSON) {
$ ("#syncLoadImg"). Hide ();
if (' 1 ' = Json.resultcode) {
Window.alert ("Sync succeeded.") ");
}else {
$ ("#syncOrderBtn"). Show ();
Window.alert ("Sync failed.") ");
}
},
Error:function () {
Alert ("Operation failed. ");
}
});
}
Problem reason: Async:false change to Async:true can (start to think that the blockui of the shutdown in front of the Ajax code, should have no relationship, but still have influence, record ... )