Я не могу получить значение объекта json, пожалуйста, дайте мне знать и пример jsfiddle.
Код jquery:
$("document").ready(function(){
$.ajax({
type: 'POST',
url: 'http://localhost/ui%20works/jsonobject.json',
success: function(callback) {
console.log(callback);
ordersList=callback;
console.log(ordersList['RestResponse']['result']["country"]);
},
error: function() {
$(this).html("error!");
}
});
});
мой json:
{
"RestResponse" : {
"messages" : [ "Total [5] records found." ],
"result" : [ {
"country" : "IND",
"name" : "Andhra Pradesh"
}, {
"country" : "AUS",
"name" : "Andhra Pradesh"
} ]
}
}