Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Selected Reading
jQuery Mobile: Sending data from one page to the another
jQuery Mobile provides several methods to pass data between pages. The most common approaches include URL parameters, localStorage, and sessionStorage.
Method 1: Using URL Parameters
Pass data through the URL query string when navigating between pages.
HTML Link with Parameters
<a href="new.html?structure=123&type=mobile">Go to New Page</a>
JavaScript to Extract Parameters
Method 2: Using localStorage
Store data in localStorage before navigation and retrieve it on the destination page.
Method 3: Using jQuery Mobile Data Attributes
Pass data using jQuery Mobile's built-in data handling.
Comparison of Methods
| Method | Data Persistence | URL Visible | Best For |
|---|---|---|---|
| URL Parameters | Page reload safe | Yes | Simple data, bookmarkable links |
| localStorage | Browser session | No | Complex objects, sensitive data |
| Data Attributes | Single navigation | No | Temporary data transfer |
Complete Working Example
Structure ID: 123 Type: mobile Processing structure with ID: 123
Conclusion
Use URL parameters for simple, bookmarkable data. Choose localStorage for complex objects or when data needs to persist across page reloads. jQuery Mobile's data attributes work well for temporary data transfer between pages.
Advertisements
