The method of Ajax synchronization to verify whether the order number exists

Time:2020-4-29

In this paper, an example is given to illustrate the method of Ajax synchronous verification of the existence of order number. To share with you for your reference, as follows:

//The method executed before saving. Ajax synchronously calls the background to verify whether the package number exists
function doBeforeSave(){
  var packageCode=document.getElementById("packageCode").Value;
  var temp=false;
  if(packageCode!=""){
    $.ajax({
     URL: "${CTX} / Finance / packagemanagement! Parcelswhetherexists. Do", // receive page
     Type: 'post', // send data by post
     Async: false, // Ajax synchronization
     data:{packageCode:packageCode},
     success: function(result) {
      temp = eval(result.result);
     }
    });
  }
  if(!temp){
   Alert ("package No. already exists! "";
   Toft. Resetform ("adddataform"); // clear the form
   toft.id("packageCode").focus();
  }
  return temp;
}

I hope that this article will be helpful to the Ajax based programming.

Recommended Today

Swift advanced (XV) extension

The extension in swift is somewhat similar to the category in OC Extension can beenumeration、structural morphology、class、agreementAdd new features□ you can add methods, calculation attributes, subscripts, (convenient) initializers, nested types, protocols, etc What extensions can’t do:□ original functions cannot be overwritten□ you cannot add storage attributes or add attribute observers to existing attributes□ cannot add parent […]