jquery Loader Widget 未显示 [英] jquery Loader Widget not showing
问题描述
我正在通过 Ajax 调用使用 Jquery 移动加载器小部件,在函数调用期间 LoadingData
它应该显示加载掩码,但它没有显示任何加载掩码,一旦完成它直接弹出结果.
I am using Jquery mobile loader widget Via Ajax call, during the function call LoadingData
it should show the loading mask , but it is not showing any loading mask, once it done it direct pop up the result.
我的代码如下
$(document).on('pageinit', function(){
$.ajax({url: "SomeURL",
beforeSend: function() { $.mobile.showPageLoadingMsg(); }, //Show spinner
complete: function() { $.mobile.hidePageLoadingMsg(); }, //Hide spinner
success: function (result) {
LoadingData(result);
},
error: function (request,error) {
alert('Network error has occurred please try again!');
}
});
});
这是我为使用加载器小部件而遗漏的任何东西吗??
Is that anything that i left out for using the loader widget ??
推荐答案
$.mobile.showPageLoadingMsg();
和 $.mobile.hidePageLoadingMsg();
被替换$.mobile.loading('show');
和 $.mobile.loading('hide');
自 jQuery Mobile 1.3.2强>.
$.mobile.showPageLoadingMsg();
and $.mobile.hidePageLoadingMsg();
are replaced by $.mobile.loading('show');
and $.mobile.loading('hide');
as of jQuery Mobile 1.3.2.
但是,在 pageinit
上使用它们需要设置时间间隔,直到页面完全初始化.
However, using them on pageinit
requires setting time interval until page is fully initialized.
在其他事件上,例如pagebeforeshow
和pageshow
,可以立即调用.
On other events, such as pagebeforeshow
and pageshow
, they can be called immediately.
这篇关于jquery Loader Widget 未显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!