Solved

jQuery Mobile events and variables

Posted on 2013-05-17
3
169 Views
Last Modified: 2013-06-18
Hi all!

I have almost finished the 1st part of my 1st web app...

I have serious problem with understanding how to handle JQM events and variables that should work for the entire page.

My app is here:

http://pitto.homeip.net/mobile

The problem is that when I select any customer in the 1st page I land on a detail page where I can add payments simply tapping on the month name.

Insert (or delete) in the database happens perfectly but my page refresh function doesn't work properly because I "lose" my variables from one function to the other.

I've tried using global variables like $.myVariables.variable without luck.

Something is wrong also probably with my events...

I do everything for the details page in the pagebeforeshow because if I use the pageinit it stops working.

Can someone provide specific help or, if not possible, also generic info? I am pulling my hair from days.
0
Comment
Question by:ltpitt
  • 2
3 Comments
 
LVL 23

Expert Comment

by:Roopesh Reddy
ID: 39233363
Hi,

Is this a single page application? If not, JavaScript variables will be lost. I also suggest you to check Knockout - http://knockoutjs.com/

Hope it helps u...
0
 
LVL 1

Accepted Solution

by:
ltpitt earned 0 total points
ID: 39246987
Acutally it was easier than that...

I simply had to declare variables at the beginning of the script (and not in the function).

This way variables are validated for all the page.

:)
0
 
LVL 1

Author Closing Comment

by:ltpitt
ID: 39255646
Nobody else provided correct information
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

There are a couple ways to attach a JavaScript function to dynamically created elements. You can make a new script for each element as it’s created or you can use delegation. Delegation allows a single script that is added at page creation to mat…
This article demonstrates how to create a simple responsive confirmation dialog with Ok and Cancel buttons using HTML, CSS, jQuery and Promises
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

929 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now