Javascript:
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function(){
if(xhttp.readyState==4 && xhttp.status==200){
document.getElementById("display_result").innerHTML=xhttp.responseText;
}
};
document.getElementById('loading').style.display='block';
xhttp.open("POST", "users_process.php", true);
xhttp.setRequestHeader('X-Alt-Referer', 'dashboard.php');
xhttp.send(data);
PHP:
<?php
$execute_query=$data_access->Execute($query);
if($execute_query==true){
header("location: dashboard.php");
}else{
echo("<div id='error'>Some error occured during uploading Please try again</div>");
}
?>