这是我在 script.js 中的 jQuery 函数。该函数用于从 Flicker 获取提要并填充结构。
我想将 html 结构填充到另一个名为“items.html”的 html 页面中
$function getImages(){
$.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?id=90528678@N03&lang=en-us&format=json&jsoncallback=?", displayImages);
function displayImages(data) {
// Start putting together the HTML string
var htmlString = '';
// Now start cycling through our array of Flickr photo details
$.each(data.items, function(i,item){
// Here's where we piece together the HTML
htmlString += '<div class="item_wrapper" name="'+item.title+'">';
htmlString += '<img class="item_picture" src="' + item.media.m + '" alt=""/>';
htmlString += '<div class="item_data">';
htmlString += '<div class="item_company">';
htmlString += '<h3 class="fi se en">'+item.title+'</h3>';
htmlString += '</div>';
htmlString += '<div class="item_title">';
htmlString += '<h3 class="fi">'+item.title+'</h3>';
htmlString += '<h3 class="se">'+item.title+'</h3>';
htmlString += '<h3 class="en">'+item.title+'</h3>';
htmlString += '</div>';
htmlString += '</div>';
htmlString += '</div>';
});
// Pop our HTML in the DIV tag of items.html
// Here's the problem.
$('div').html(htmlString);
}
}
那么我该怎么做呢?谢谢 !!!