jQuery Validate remote method usage to check if username already exists
//HTML
$("#signupForm").validate({
rules: {
username: {
required: true,
minlength: 3,
remote: "check-username.php"
}
},
messages: {
username:{
remote: "This username is already taken! Try another."
}
}
});
//PHP code of check-username.php
<?php
header('Content-type: application/json');
$request = $_REQUEST['username'];
$query = mysql_query("SELECT * FROM mmh_user_info WHERE username ='$username'");
$result = mysql_num_rows($query);
if ($result == 0){
$valid = 'true';}
else{
$valid = 'false';
}
echo $valid;
exit;
?>
Also in JavaScript:
- best react native animation library
- javascript class click event
- javascript foreach get key and value
- javascript get array object by id
- npm react native turn by turn navigation
- fillstyle
- docker react module not found
- display image base64 in REACT NATIVE
- javascript hash string
- find in string javascript
- jquery continue each loop
- change the color of text in javascript
- push javascript
- jQuery Event Methods
- nestjs AXIOS_INSTANCE_TOKEN
- node js async delay
- Convert a date to yyyy mm dd format
- javascript detect browser
- onclick in js
- js navigate to another page
- javascript round down
- mongoose generate objectid
- view background image in react native
- chartJs height