Home > Article > Web Front-end > Use ajax to verify whether the order number exists in the database
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; }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!