Home  >  Article  >  Backend Development  >  Ajax synchronously verifies whether the order number exists

Ajax synchronously verifies whether the order number exists

小云云
小云云Original
2018-01-12 14:50:261226browse

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

//保存前执行的方法,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;
}

Related recommendations:

Issues related to browser compatibility of ajax synchronization mode

##jquery ajax synchronization and asynchronous execution final Solution_jquery

Ajax synchronous and asynchronous transmission sample code_javascript skills

The above is the detailed content of Ajax synchronously verifies 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