There are hundreds of records when I do this but I can't add any other info:
function(data){
$.each(data.products, function(i,item){
$("<img>").attr("src", item.imag开发者_开发问答eUrl).appendTo("#pear");
if ( i == 100 ) return false;
});
});
But when I use this I only get one record:
function(data){
$.each(data.products, function(i,item){
$("#images").html("<li><a href='"+item.pUrl+"'><img src='"+item.iUrl+"'></a>"+"<br>"+item.Name+"<br>"+"$"+item.salePrice+"</li>");
if ( i == 100 ) return false;
});
});
Can somene please explainto me what I am doing wrong - very new to this. Thanks
Right now the bottom code replaces all code in #images
I think this would be better
function(data){
$.each(data.products, function(i,item){
$("#images").append("<li><a href='"+item.pUrl+"'><img src='"+item.iUrl+"'></a>"+"<br>"+item.Name+"<br>"+"$"+item.salePrice+"</li>");
if ( i == 100 ) return false;
});
});
精彩评论