Skip to content

Instantly share code, notes, and snippets.

@iksela
Created June 30, 2011 09:53
Show Gist options
  • Select an option

  • Save iksela/1055947 to your computer and use it in GitHub Desktop.

Select an option

Save iksela/1055947 to your computer and use it in GitHub Desktop.
Remote validation
$("#form").validate({
rules: {
code: {minlength:3,maxlength:6,remote:'validate.php'}
},
messages: {
code: {
remote: 'This code is already in use.'
}
}
});
<?php
// the value is passed as a get parameter
$code = $_GET['code'];
$valid = false;
/* if code available --> put $value = true; */
echo json_encode($valid);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment