jQuery Mobile Cannot read 'options' of undefined on trigger('pagecreate')

我与影子孤独终老i 提交于 2019-12-08 05:22:36

问题


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');
    });

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

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


回答1:


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

Try with jQuery 1.9.1



来源:https://stackoverflow.com/questions/16151790/jquery-mobile-cannot-read-options-of-undefined-on-triggerpagecreate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!