问题
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