Formatting JSON.stringify code
I have made my callback and now have my hotel list outputted into my
browser using JSON.stringify and removed the ugly quotes.
How do I now take only the values I need such as address, hotel name and
style these using css?
I can only manage to output the whole callback without any styling
$.ajax({ url:
"http://api.eancdn.com/ean-services/rs/hotel/v3/list?cid=55505&minorRev=20&apiKey=cbrzfta369qwyrm9t5b8y8kf&locale=en_AU&city=Sydney&stateProvinceCode=NW&countryCode=AU&numberOfResults=2&type=json",
dataType: "jsonp", jsonpCallback:"myCallback",
success: function(data) {
var StrHotelListResponse = data.HotelListResponse.HotelList.HotelSummary;
$.each(StrHotelListResponse, function(index, value) {
var StrHotelListResponse = JSON.stringify(data);
$('#target').append(StrHotelListResponse.replace(/\"/g, ""));
$('#target').console.log(JSON.stringify(StrHotelListResponse));
});
},
error: function(e) {
console.log(e.message);
//alert('no');
}
}); });
No comments:
Post a Comment