Solved

jQuery Mobile events and variables

Posted on 2013-05-17
3
178 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

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 how to dynamically set the form action using jQuery.
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…

726 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