I have this code and I want to specify if the validateUser function is true or false. How can I do it since in the code there is already a function in the .post()
?
Here is the code
function validateUser() {
var user = $("#username").val();
$.post('usercheck.php', $("#form").serialize(), function (data) {
var usercheck = data;
if (usercheck != "") {
$("#div").html("Username already exists");
return false;
} else {
$("#div").html("ok");
return true;
}
});
}