我正在尝试使用名为autoscroll的 jQuery 插件在我的网站上显示评论。但是,我正在努力使用 AJAX 从我的数据库中提取评论,并且template
从未调用过该函数。
$(".Reviews").autobrowse({
url: function (offset) {
//return Healthimized.Services.ClientUserServices.LoadClientUserReviews(1, LoadCustomerToSelectOption, ErrorHandler, onTimeOut)
$.ajax({
type: "POST",
url: 'Services/ClientUserServices.asmx/GetAllSpecialities',
//data: parameters,
contentType: "application/json; charset=utf-8",
//data: { fromDate: new Date(), toDate: new Date(), clientUserId:1},
//data: "{'fromDate':'" + startFrom + "','toDate':'" + endTo + "','clientUserId':'" + doctorId + "'}",
dataType: "json",
//data: 'fromDate=' + new Date() + '&toDate=' + new Date() + '&clientUserId='+1,
success: function (msg) {
return "http://twitter.com/status/user_timeline/ParisHilton.json?count=10&page=OFFSET&callback=?".replace(/OFFSET/, 1+Math.round(offset/10));
},
error: function (e) {
$(divToBeWorkedOn).html("Unavailable");
}
});
},
template: function (response) {
var markup='';
for (var i=0; i<response.length; i++) {
markup+='<div style="background:rgba(0, 0, 0, 0.1);margin: 2% 2% 2% 2%;border-radius: 0.5em 0.5em 0.5em 0.5em;"><table>';
markup += '<tr><td>';
markup += '<img src="' + response[i].user.profile_image_url + '" /></td>';
markup += '<td style="margin-top:-15px">'+response[i].text+'</td>';
markup += '</tr></table></div>';
}
return markup;
},
itemsReturned: function (response) { return response.length; },
max: 100,
loader: '<div class="loader"></div>',
sensitivity: 100,
finished: function () { $(this).append('<p style="text-align:center"><b>No More Reviews to show</b></p>') }
});
});