jQuery的加载程序小部件不显示 [英] jquery Loader Widget not showing

查看:85
本文介绍了jQuery的加载程序小部件不显示的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在通过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起,

="p2 $.mobile.showPageLoadingMsg();$.mobile.hidePageLoadingMsg();替换为$.mobile.loading('show');$.mobile.loading('hide');. /p>

但是,在pageinit上使用它们需要设置时间间隔,直到页面完全初始化.

在其他事件(例如pagebeforeshowpageshow)上,可以立即调用它们.

演示

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.

Demo

这篇关于jQuery的加载程序小部件不显示的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆