开发者

jquery validate remote response format

Trying to validate nickname using the remote method

rules: {
     nickname: {
           required: true,
           remote: "checknick.php"
     }
}

And checknick is here

$name = addslashes($_POST['nickname']);

$sql="select * from names wher开发者_开发问答e nickname='$name'";
$result=mysql_query($sql);
$num_rows = mysql_num_rows($result);

if($num_rows > 0 ) {
   $valid='false';
} else {
   $valid = 'true';
}


echo $valid;

This isn't validating for me. Can anybody help me out here.


Which validation plugin are you using?

I would try json encoding the response:

echo json_encode($valid);


json_encode($valid); isnt the issue, remote uses $_GET['nickname']

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜