当用户在执行 AJAX 获取时单击可折叠部分时,我试图显示加载消息。我正在使用 SPServices 库来执行获取。基本上加载消息不显示。一旦 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 () {
....
});
}
});
}
});
});