I'm a bit confused on how to use the ajax .done() function. I'm working on validating a form to check if a user exists in database and though ajax would be the best approach (still learning it). I have a php file that return true if user exists and false if user doesn't exist. How would I pass the boolean into the parameter for the done function?
$(".check").blur(function(){
  var username = $(".check").val();
  $.ajax({
    url: "validateUser.php",
    type: "post",
    data: "username= " + username
  }).done(function(result){
    if (result == true){
      // User exists
    }else{
      // User doesn't exist
    }
  });
});
I hope that made sense. I did my best to explain it.
 
     
     
    