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']
精彩评论