I have a php script and a jquery script that runs well on localhost (WAMP)but not on my bluehost account.
if i run the same file on live server, the Jquery success function return my json data as null, but not like so on localhost.
below are my codes:
php code:
$transaction_id = trim($_POST['transaction_id']);//get the Transaction ID from Ajax request..
//get the full transaction details as an json from VoguePay
$json = file_get_contents('https://voguepay.com/?v_transaction_id='.$transaction_id.'&type=json');
$transaction=json_decode($json, true);
header('Content-Type: application/json');
echo json_encode($transaction);
The Jquery Section:
event.preventDefault();
//clear the display section
$("#id-input2").html('');
var data="";
//call the Ajax Request..
$.ajax({
url: "php/fetch_transaction_id.php",
type: "POST",
data: {transaction_id:transaction_id},
dataType: "json",
beforeSend: function () {
$("#transaction_id").attr('disabled', true);
$('#searchID').attr('disabled', true);
$('#searchID').val('please wait, sending data...');
},
success: function (vp_response) {
$.map(vp_response, function(index, value) {
data=index + ' : ' + value;
$("#id-input2").append($("<li>").append(data));
$("#id-input2").css('list-style-type', 'none');
});
$('#searchID').val('Data Received!');
},
error: function () {
$("#id-input2").append('Sorry, There was an error whilst processing your request');
$("#transaction_id").removeAttr('disabled');
$("#transaction_id").val('');
$("#transaction_id").focus();
$('#searchID').removeAttr('disabled');
$('#searchID').val('Query Transaction');
return false;
}
});
Like i said earlier, this file runs on localhost and displays results accordingly. But it doesn't display any data but 'null' on live server.