当用户在执行AJAX get时单击可折叠部分时,我正在尝试显示加载消息。我正在使用SPServices库来执行get。基本上没有显示加载消息。一旦SPServices操作和单击事件结束,它将显示。我是否正确定义了此点击事件?感谢。
$(document).bind('pageinit', function (event) {
$('.ui-collapsible').click(function (event, data) {
$.mobile.showPageLoadingMsg();
var myQueryOptions = "";
var myQuery = "";
if ($(this).attr('id') == "NewsContainer" && $("#NewsList li").size() == 0) {
var myQueryOptions = "<QueryOptions><ViewAttributes Scope='RecursiveAll' IncludeRootFolder='True' /></QueryOptions>";
var myQuery = "<Query><Where><BeginsWith><FieldRef Name='ContentTypeId' /><Value Type='ContentTypeId'>0x010100C568DB52D9D0A14D9B2FDCC96666E9F2007948130EC3DB064584E219954237AF3900DD0126D65DE8404CB540571DFA751B850301</Value></BeginsWith></Where></Query>";
}
if (myQueryOptions != "" && myQuery != "") {
$().SPServices({
operation: "GetListItems",
async: false,
listName: "Pages",
CAMLViewFields: "<ViewFields><FieldRef Name='Title' /><FieldRef Name='PublishingPageContent' /><FieldRef Name='NewsDate' /></ViewFields>",
CAMLQuery: myQuery,
CAMLRowLimit: 5,
CAMLQueryOptions: myQueryOptions,
completefunc: function (xData, Status) {
$(xData.responseXML).SPFilterNode("z:row").each(function () {
....
});
}
});
}
});
});
答案 0 :(得分:0)
将showLoading
之后的JS放在超时处理程序中应该可以得到预期的结果。
请参阅此问题:Show loading spinner before heavy processing in jQuery Mobile 1.1?