0
我能够显示前两个帖子和一个按钮“加载更多”,但当我按“加载更多”按钮时,它仍然获得相同的两个职位。 你能看看我的代码,并帮我找到错误。jquery加载相同的帖子,而不是追加新的帖子
$("#load_more_posts").click(function() {
var offset = offset+limit;
$.post('cont/get_list', {limit: limit, offset: offset}, function (data) {
if (data.message !== undefined) {
$("#list_is_not_got").text(data.message);
} else {
var item = $('<div>');
$.each(data.results, function(i, res) {
var info = $('<p>');
info.html(res.post_text+'<hr>');
item.append(head,info);
});
$("#list_is_got").html(item);
}
}, "json");
});
这几乎似乎更有点后端问题。你可以粘贴你的后端代码吗?服务器回复什么? – 2014-09-02 16:46:32
服务器带回了前两个帖子,正如我在我的问题中提到的。问题出在我的jQuery代码中。 { “结果”:[{ “POST_TEXT”: “好”},{ “POST_TEXT”:“酷”}]} – EducateYourself 2014-09-02 16:56:17