function cherchePhoto(motcle) {
var url="http://api.flickr.com/services/feeds/photos_public.gne?tags="+motcle+"&tagmode=any&format=json&jsoncallback=?";
// Appel AJAX
$.ajax({
url:url,
type: 'GET',
dataType: 'json',
success : function(){
$('#images').empty();
$.each(data.items, function(i,item){
$(document.createElement('img')).attr('src', item.media.m).appendTo("#images");
});
}
})
}
I have this jQuery function with an ajax call and I want to build a img tag with the src attribute after #images in my html page for each images I receive from the ajax call. But I get an uncaught reference error with 'data' not defined, why ?