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

Ajax synchronously verifies whether the order number exists

小云云
Release: 2023-03-19 13:32:01
Original
1255 people have browsed it

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;
}
Copy after login

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!

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template