I have a function, in which we do request to a service(a php file) using ajax call. In which I have PHP function which read data From DB and send that back, in case of failure while getting the data I do redirect using header to the error file.
On my local machine all works fine even with http/https request. But on a specific sever which has all same configuration settings as my local one, it header request is "Aborted" and redirection fails.
I would like to know what things might lead to such situation. What is the
REASON of such behaviour.
Ajax Call :
$.ajax({
url: 'getdataForUser.php',
type: 'POST',
data: { 'User' : userName
},
dataType: 'html',
success: function (data) {
console.log(data);
},
error : function() {
console.log('call error .');
}
});
PHP Function : getdataForUser.php
<?php
session_start();
if(isset($_POST))
{
$transaction = array('User' => $_POST['User']
);
}
$result = $client->__soapCall("GetUserDetails",array($transaction));
if($result == FALSE)
{
header( 'Location: error.php' );
die();
}
print_r($result);
?>