$ .mobile.showPageLoadingMsg()无法正常工作 [英] $.mobile.showPageLoadingMsg() is not working

查看:160
本文介绍了$ .mobile.showPageLoadingMsg()无法正常工作的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是jquery mobile的新手,同时提出了ajax请求,我用它来显示加载消息,直到得到服务器的响应为止.我为此做了很多尝试,但没有用.任何人都可以帮助我解决这个问题,谢谢..

I am new to the jquery mobile while making ajax request i use to display the loading message until getting the response from sever. I tried a lot for this but no use.can any one help me out from this issue thanks in advance..

bellow ajax呼叫代码

bellow ajax call code

        $.ajax({ 
    url: "url", 
    type: "GET",
    contentType: "application/json; charset=utf-8",                  
    beforeSend: function(){
     setTimeout(function(){
     $.mobile.loading('show');},1);  
     },
     success: function(msg) {
      // $.mobile.loading('hide');
     $.each(msg.empWall, function() {   
      alert(this.name);          
      });
      },
      error: function(err) {
      alert(err.toString());
      },
      complete: function(){
      setTimeout(function(){
     $.mobile.loading('hide');
     },1);  
     });

推荐答案

Web-kit浏览器在以编程方式执行jQuery Mobile加载程序时遇到问题,但可以这样执行:

Web-kit browser have a problem with programatical execution of jQuery Mobile loader, but it can be executed like this:

显示:

setTimeout(function(){
    $.mobile.loading('show');
},1);  

隐藏:

setTimeout(function(){
    $.mobile.loading('hide');
},1);  

它们只需要由 setTimeout setInterval 功能引起的一小段延迟.

They just need a small delay caused by setTimeout or setInterval function.

这篇关于$ .mobile.showPageLoadingMsg()无法正常工作的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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