What Is the Format of an AJAX Request?

Depend On the User.

$(document).ready(function(){
$("#loginButton").click(function(){
var username=$("#userName").val();
var password=$("#passWord").val();
if(username==''){
$("#userName").focus();
}else{
if(password==''){
$("#passWord").focus();
}else{
$.ajax({
url:"functions.php",
type:"POST",
data:{'action':'fetch_main_user','username':username,'password':password},
dataType:"json",
success:function(response){
if(response.bool){
$(".response-body").html('<td colspan="2"><span class="alert alert-success">'+response.msg+'</span></td>');
}else{
$(".response-body").html('<td colspan="2"><span class="alert alert-danger">'+response.msg+'</span></td>');
}
// $("#userName").val('');
// $("#passWord").val('');
}
}); //End Ajax
}
}

});
});

Ajax login with php and mysql
 
Back
Top