【发布时间】:2014-03-28 11:38:00
【问题描述】:
我正在使用 jQuery jTable,它在加载数据并显示一长串数据之前首先给出消息“无可用数据”。那么是否可以在后台加载数据时首先显示 Ajax 加载程序(loading.gif)?
编辑@Rex:我试过了,但不知道如何使用 jQuery jTable 成功函数来实现它。
这是我试过的代码:
$(document).on('click', '#PlayStatisticone', function (e) {
function loadingAjax(div_id) {
var divIdHtml = $("#"+div_id).html();
$.ajax({
url: '@Url.Action("_TopPlayedTracksPermissionCheck", "ReportStatistic")',
type: 'POST',
beforeSend: function() {
$("#loading-image").show();
},
success: function (data) {
$("#"+div_id).html(divIdHtml + msg);
$("#loading-image").hide();
$(function () {
$("#PartialViewTopPlayedTracks").load('@Url.Action("_PartialViewTopPlayedTracks", "ReportStatistic")');
});
},
error: function (xhr, textStatus, exceptionThrown) {
var json = $.parseJSON(xhr.responseText);
if (json.Authenticated) {
window.location.href = '/UnAuthorizedUser/UnAuthorizedUser';
}
else {
window.location.href = '/UnAuthenticatedUser/UnAuthenticatedUser';
}
}
});
任何建议都会很有帮助 提前致谢。
【问题讨论】:
-
@Rex 谢谢 - 我已经更新了我尝试过的代码的最终版本。它根本不起作用:(
标签: c# asp.net ajax loading jquery-jtable