jQuery的加载程序小部件不显示 [英] jquery Loader Widget not showing
问题描述
我正在通过Ajax调用使用Jquery移动加载器窗口小部件,在函数调用LoadingData
期间,它应该显示加载掩码,但是一旦执行后直接弹出结果,它就不会显示任何加载掩码.
我的代码如下
$(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!');
}
});
});
是我没有使用加载程序小部件的所有内容吗?
从 jQuery Mobile 1.3.2起,$.mobile.showPageLoadingMsg();
和$.mobile.hidePageLoadingMsg();
替换为$.mobile.loading('show');
和$.mobile.loading('hide');
. /p>
但是,在pageinit
上使用它们需要设置时间间隔,直到页面完全初始化.
在其他事件(例如pagebeforeshow
和pageshow
)上,可以立即调用它们.
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.
my code is as follow
$(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();
and $.mobile.hidePageLoadingMsg();
are replaced by $.mobile.loading('show');
and $.mobile.loading('hide');
as of jQuery Mobile 1.3.2.
However, using them on pageinit
requires setting time interval until page is fully initialized.
On other events, such as pagebeforeshow
and pageshow
, they can be called immediately.
这篇关于jQuery的加载程序小部件不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!