Validate verifies that the remote parameter is used in the asynchronous database query validation process.
There are url,datatype,data,type and so on in remote, the default is the value of the currently validated field when data is not written. To the PHP file, the return value is "true" or "false" when processed in the PHP file, and the return value needs to be quoted.
Here is a test case:
JS's wording
var option = {rules:{baleno:{required:true, remote:{url:checkbalenourl, type: ' Post ', DataType: ' JS On ',}}, expressnolist:{required:true},}, messages:{baleno:{required: ' Pallet number cannot be empty ', Remote: ' The pallet number has been saved In ',}, expressnolist:{required: "Waybill number cannot be empty"},}};
Syntax for methods in PHP:
Public Function Ajaxchecktrayno () {if ($_request[' Baleno ']!= ') {$model = M ("Ordertray"); $map [' tray_no '] = $_request[' Baleno '); $number = $model, where ($map), count (); if ($number >0) {echo "false"; }else{echo "true"; }}else{echo "false"; } }
This article is from "Buffy Rain Blog" blog, please be sure to keep this source http://bafeiyu.blog.51cto.com/5401101/1599317
jquery plugin validate inside the remote parameter usage