Home > Web Front-end > JS Tutorial > Use ajax to verify whether the order number exists in the database

Use ajax to verify whether the order number exists in the database

php中世界最好的语言
Release: 2018-04-03 16:28:07
Original
1531 people have browsed it

This time I will bring you how to use ajax to verify whether the order number exists in the database, and use ajax to verify whether the order number exists in the database. What are the precautions? The following is a practical case, let's take a look.

The example in this article describes the method of ajax synchronously verifying whether the order number 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;
}
Copy after login
I believe you have mastered the method after reading the case in this article. For more exciting information, please pay attention to other related articles on the php Chinese website!

Recommended reading:

Ajax+mysq realizes the three-level linkage list of provinces and municipalities

Ajax transmits Json and xml data Detailed explanation of the steps (with code)

The above is the detailed content of Use ajax to verify whether the order number exists in the database. 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