I'm using the JQuery validation plugin, and added a new method for check availability of name in the database. Php script works well and return 1 or 0 correctly. But the method always returns "Name is not available".
jQuery.validator.addMethod("loginAvailability", function(value, element) {
$.post("CheckLogin.php", { login: value },
function(result){
console.log(result);
console.log(value);
return result;
}
)},"Name is not available");
There is console log( "abc" user in database ):
0
abc
1
qwe
That all works well, when we test that on xammp local server, but doesn't work on real server.