I'm trying to implement basic Parse (based on Backbone.js) functionality in a web interface built with JQueryMobile. I successfully set up logging in using Parse.User.logIn, and it doesn't give any errors when I call logOut later on. However, if I put "$.mobile.changePage($("#pagename"), {transition : "slideup"}); to go back to the login page, then it gives the following error:
Uncaught TypeError: Cannot call method '_trigger' of undefined
Here's the script:
$("div[data-role*='page']").live('pageshow',function(){
$(".logout-link").click(function(){
console.log('Clicked log out')
Parse.User.logOut();
$.mobile.changePage($("#login-page"), {transition : "slideup"});
});
});
I know that JQueryMobile works with Parse (https://parse.com/questions/does-the-parse-javascript-sdk-work-with-jquery-mobile) but there's extra stuff you have to do which I don't quite understand yet. Not sure if that's related to this problem.
While I'm at it, what does it mean when you start a js file off with the following line:
$(function(){
(which encapsulates all the code in the file).