Ajax synchronous verification of the existence of the ticket number method, ajax synchronous verification of the existence
This article describes how to verify the existence of the ajax synchronous ticket number. We will share this with you for your reference. The details are as follows:
// Save the method executed before. ajax synchronously calls the background to verify whether the package ticket number has function doBeforeSave () {var packageCode = document. getElementById ("packageCode "). value; var temp = false; if (packageCode! = "") {$. Ajax ({url: "$ {ctx}/finance/packageManagement! ParcelsWhetherExists. do ", // receiving page type: 'post', // send data async: false in post mode, // ajax synchronize data: {packageCode: packageCode}, success: function (result) {temp = eval (result. result) ;}}) ;}if (! Temp) {alert ("The package number already exists! "); Toft. resetForm (" addDataForm "); // clear the form toft. id (" packageCode "). focus () ;}return temp ;}
I hope this article will help you with ajax-based programming.