im working with a JSON object here, i want to access the images, its an array within the array of 'results'. I know i have to loop, but not sure if im doing it correctly
My Code
function getVideos(art) {
$.ajax({
type: "GET",
url: 'http://imvdb.com/api/v1/search/videos?q=' + art,
dataType: 'json',
success: function (data) {
//alert(JSON.stringify(data.albums.name));
$('#videos').empty();
$.each(data.results.image, function (index, element) {
//alert(element.name);
$('#videos').append(element.results.image+ '<br/>');
});
},
error: function (data) {
$('#videos').html('<h3>Error in retrieval</h3>');
}
});
}
UPDATE when i just code
$.each(data, function (index, element) {
//alert(element.name);
$('#videos').append(element.results+ '<br/>');
});
i get
UPDATE:
it works for me now i just was accessing results instead of images
$.each(data.results, function (index, element) {
//alert(element.name);
$('#videos').append(element.image.o + '<br/>');
});