Home  >  Article  >  Web Front-end  >  Ajax method to synchronously verify whether the order number exists

Ajax method to synchronously verify whether the order number exists

亚连
亚连Original
2018-05-23 15:16:171368browse

This article mainly introduces the method of ajax synchronous verification of the existence of the order number, involving the operation skills related to data interaction based on ajax. Friends in need can refer to it

The example of this article tells the ajax synchronization verification of the order number method exists. Share it with everyone for your reference, the details are as follows:

//保存前执行的方法,ajax同步调用后台验证包裹单号是否存在
function doBeforeSave(){
  var packageCode=document.getElementById("packageCode").Value;
  var temp=false;
  if(packageCode!=""){
    $.ajax({
     url: "${ctx}/finance/packageManagement!parcelsWhetherExists.do", //接收页面
     type: 'post',  //POST方式发送数据
     async: false,  //ajax同步
     data:{packageCode:packageCode},
     success: function(result) {
      temp = eval(result.result);
     }
    });
  }
  if(!temp){
   alert("包裹单号已存在!");
   toft.resetForm("addDataForm");//清空表单
   toft.id("packageCode").focus();
  }
  return temp;
}

The above is what I compiled for everyone, I hope it will be helpful to everyone in the future.

Related articles:

js ajax handles the json object returned by the java background and loops it to create a table method

Ajax gets the data and then displays it Implementation method on the page

Ajax setting async implementation method to verify whether the user name exists

The above is the detailed content of Ajax method to synchronously verify whether the order number exists. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn