jQuery Mobile无法读取触发器('pagecreate')上未定义的'options' [英] jQuery Mobile Cannot read 'options' of undefined on trigger('pagecreate')

查看:72
本文介绍了jQuery Mobile无法读取触发器('pagecreate')上未定义的'options'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在将一个外部页面加载到我的jqm页面上的div中,并且为了通过jQuery移动样式(我在div上称为trigge('pagecreate')来增强它)从控制台开始工作.

I am loading an external page into a div on my jqm page and in order to enhance it with the jQuery mobile styles I call trigge('pagecreate') on the div, this works from the console.

 $('#search-results-page').load('searchResults.php',{options:$.encodeJSON(data.options),search:$.encodeJSON(data.search)},function () {
        $(this).trigger('pagecreate',{options:{}});
        $.mobile.changePage('#search-results-page');
    });

如果我将代码放在try catch块中会起作用,但如果不这样做,则会出现此错误:

It works if I put my code in a try catch block but if I don't then I get this error:

未捕获的TypeError:无法读取未定义的jquery.mobile-1.3.1.js:7535的属性选项"

Uncaught TypeError: Cannot read property 'options' of undefined jquery.mobile-1.3.1.js:7535

推荐答案

我收到此错误,这是因为我使用的是jQuery 2.0.0

I got this error and it was because I was using jQuery 2.0.0

尝试使用jQuery 1.9.1

Try with jQuery 1.9.1

这篇关于jQuery Mobile无法读取触发器('pagecreate')上未定义的'options'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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