here’s my jquery:
$.ajax({
url: 'function.php',
type: 'post',
datatype: 'json',
success: function(data){
var toAppend = '';
if(typeof data === "object"){
for(var i=0;i<data.length;i++){
toAppend += '<li>'+data[i]["asin"]+'</li>';
}
$('.results').append(toAppend);
}
}
});
here’s my php:
echo json_encode($items_from_amazon);
I already use the firebug and i get successfully the json values from response but why i am getting object object output?what wrong?am i missing something?
From what i see in your
print_r($items_from_amazon);output, you have Array-Object-Object, try use this code: