Here is the partial code from the remove PHP file:
if($action == 'trackings_get') {
$result = $trackings->get(getCourierSlugByID($GLOBALS['tracking_id']), $GLOBALS['tracking_id']);
$result_history = $result['data']['tracking']['checkpoints'];
echo json_encode($result_history);
// debugging
//pretty_print($result_history);
}
Here is the JS from the remote site i am trying to call the data for:
$.ajax({
url: '/login/tracking.php',
type: 'POST',
dataType: "json",
data: {
action: action,
tracking_id: tracking_id
},
success: function(json){
//debug
alert(JSON.stringify(json));
}
});
2 Answers 2
try this
function test(){
$.ajax({
url: 'url',
type: 'POST',
dataType: "json",
data: {
action: action,
tracking_id: tracking_id
},
success: function(json){
}
});
}
Sign up to request clarification or add additional context in comments.
Comments
i try this code in inspect element in this page https://tracking.ambientlounge.com/
function test(){
$.ajax({
url: 'your url',
type: 'POST',
dataType: "json",
data: {
action: "action",
tracking_id: "tracking_id"
},
success: function(json){
//debug
console.log(json);
}
});
}
result is array . dont need JSON.stringify .
answered Dec 7, 2017 at 6:09
ali zarei
1,25111 silver badges18 bronze badges
4 Comments
Death-is-the-real-truth
ali zarei you used hardcoded value in url and hens POST method and data sending become useless. That's not the right way to do so
ali zarei
it is a sample only !!
Death-is-the-real-truth
then it's wrong way to giving sample. This sample will serve future visitors too. So it will misguide them as well.
James
Yes I agree, can you please modify this Answer as dont want URLs or screenshots to this system. I have adjusted the questiont o remove the POST URL to remove this but please adjust your reply.
default
alert(JSON.stringify(json));toconsole.log(json);and see what is coming in console. Now you can use thatjson(if output is coming fine.) . You useddataType: "json",so no need ofJSON.stringify()