【问题标题】:Jquery mobile loading does not workjQuery移动加载不起作用
【发布时间】:2013-09-18 16:22:57
【问题描述】:

我想显示加载 gif,直到使用 jquery mobile 加载数据 但它不起作用..在控制台中它给出了那个错误

Uncaught TypeError: Object #<Object> has no method 'loading'  

这是我的页面:enter link description here

在这个页面中我添加了代码

 $.mobile.loading( 'show');

这不起作用:enter link description here

我的代码

 <script type="text/javascript">
            $('#details').live('pageinit', function (event) {
$.mobile.showPageLoadingMsg();
                $("#listeu").empty();
                $.getJSON('http://teknonova.com/Map/Home/getir3/1', function (data) {

【问题讨论】:

  • 你怎么称呼它,什么时候?请发布更多相关信息。
  • 您正在使用 JQM 1.0 版或者使用 $.mobile.showLoadingMsg(); 或升级到最新的稳定版 1.3.2
  • 对不起,$.mobile.showPageLoadingMsg();
  • @Omar 我使用了 $.mobile.showPageLoadingMsg();但它仍然给出相同的错误..您可以查看链接中的所有代码..我尝试提供所有代码但 stackoverflow 不允许
  • 您使用的是什么版本的 JQM?粘贴如何调用微调器的代码。没有人会检查您的所有代码并对其进行调试。请帮助我们为您提供帮助。

标签: javascript jquery jquery-mobile loading


【解决方案1】:

错误听起来像是 jquery mobile 库未正确加载(可能在 jquery 之前加载并且初始化失败)或 jquery mobile 的版本不支持该方法。

我会使用开发控制台查看 $.mobile 对象是什么以获得更多线索

【讨论】:

  • 我将我的代码添加到此事件中:$('#details').live('pageinit', function (event) { 这是控制台屏幕:n1309.hizliresim.com/1f/l/su0hr.png
  • 很难说。如果删除该行并在控制台窗口中调用 $.mobile.loading('show') 会发生什么?我忘记了 pageinit 事件是否太早了。也许可以尝试 pageshow 或 pagebeforeshow 事件。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2016-03-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2020-05-09
  • 1970-01-01
相关资源
最近更新 更多