// Calling the video function with JSON
$.getJSON("videos.php", function(data){
// first check if there is a member available to display,
//if not then show error message
if(data == '') {
$('#tabs-4').html("<div class='errorMember'>Sorry, there is currently no member available videos</div>");
}
// if there is a member, then loop through each data available
else {
$.each(data, function(i,name){
content = '<div class="left"><img src="' + name.pic + '"/>';
content += '<p>' + name.name + '</p>';
content += '<a href="' + name.link + '" target="_blank">Video link</a>';
content += '</div><br/><hr>';
$("#tabs-4").html(content);
});
}
});
问题是它只给了我一个结果而不是数组中的结果列表,但是如果我 appendTo(content) .. 它会在 current 下添加完整的结果列表,这不是我想要的,因为我需要刷新该内容与更新的数据。
对我做错了什么有任何想法吗?