I'm facing a problem in getting the return value from PHP to JSON.
If success or failure the alert will be displayed with the content of a javascript file inside include '../core/init.php';
. But I need only success or failed in alert. Please help
Requestfile:
$id = intval($_REQUEST['id']);
$empid=$_REQUEST['empid'];
include '../core/init.php';
if($user_data['empid']==$empid){
$delete_sql = "delete from datatable where sl=$id";
mysql_query($delete_sql);
echo json_encode("success");
}
else{
echo json_encode("failure");
}
Main Page:
$.ajax({
url: 'returnpage.php',
type: 'post',
data: {
'id' : row.sl,
'empid':row.empid
},
success:function(status){
alert(status);
},
error:function(status){
alert(status);
}
Alert window:
<style>
/*html {
background: url(includes/background.jpg) no-repeat center center fixed;
-webkit-background-size: cover;
-moz-background-size: cover;
-o-background-size: cover;
background-size: cover;
}*/
</style>
<script type="text/javascript" src="css/js/browsercheck.js"></script>
<script >
var browser_name=browserinfo();
//alert(browser_name);
if(browser_name!=="Firefox"){
window.location="non_compatible_browser.php";
}
</script>
<script type="text/javascript" src="css/js/browsercheck.js"></script>
<script >
// alert("Application Will be down..!!\nFrom 23-Jan-2016 07:15 PM to 23-Jan-2016 08:15 PM \nPlease save the data. ")
var browser_name=browserinfo();
//alert(browser_name);
if(browser_name!=="Firefox"){
window.location="non_compatible_browser.php";
}
//window.location="Maintenance_page.php";
//exit();
</script>
"failure"