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