No results are returned when using Flickr JSON request
Posted
by
Martijn1981
on Stack Overflow
See other posts from Stack Overflow
or by Martijn1981
Published on 2011-01-13T10:49:48Z
Indexed on
2011/01/13
10:54 UTC
Read the original article
Hit count: 190
I'm still fairly new to AJAX and I'm experimenting with Twitter and Flickr. Twitter is working fine so far, but I've run into some issues with the Flickr API.
I'm getting no results back. The URL seems to be working fine and I'm pointing to the right object containing the array ('items'). Can anybody tell me what I'm doing wrong please? Thanks!
$('#show_pictures').click(function(e){
e.preventDefault();
$.ajax({
url: 'http://api.flickr.com/services/feeds/photos_public.gne?format=json&jsoncallback=?&tags=home',
dataType: 'jsonp',
success: function(data) {
$.each(data.items, function(i, item){
$('<div></div>')
.hide()
.append('<h1>'+item.title+'</h1>')
.append('<img src="'+item.media.m+'" >')
.append('<p>'+item.description+'</p>')
.appendTo('#results')
.fadeIn();
})
},
error: function(data) {
alert('Something went wrong!');
}
});
});
© Stack Overflow or respective owner