jQuery AJAX(index.php)
$.ajax({url:"xyz.php",type:"POST",
data: {'login': email,'password': pass},
dataType: "json",
success:function(r){
if(r["status"]==='success')window.location.href="abc.php"
else {$("#ErrorMsg").fadeIn();$("#Loader").hide();$("#SendButton").fadeIn();}
},
beforeSend:function(){$("#SendButton").hide();$("#Loader").fadeIn();},
error:function(x,e){
if(x.status==0){
alert('You are offline!!\n Please Check Your Network.');
}else if(x.status==404){
alert('Requested URL not found.');
}else if(x.status==500){
alert('Internel Server Error.');
}else if(e=='parsererror'){
alert('Error.\nParsing JSON Request failed.');
}else if(e=='timeout'){
alert('Request Time out.');
}else {
alert('Unknow Error.\n'+x.responseText);
}
$("#Loader").hide();$("#SendButton").fadeIn();
}
});
PHP(xyz.php)
$DataSet = mysql_fetch_array(mysql_query("select * from administration where ADMIN_EMAIL_ID='$_POST[email]'"));
if(strcmp($DataSet[2],$_POST['pass'])==0)
{
session_start();
$_SESSION['Aunthentication'] = "Yes";
echo json_encode(array('status' => "success"));
//echo"approved";
}
else echo json_encode(array('status' => "failed"));