Basic app development using jqMobi: Page value passing Method

Source: Internet
Author: User

The main methods for transferring values between two pages in the PC web application include cookie, query string, and data exchange through session on the server side. But what about the value transfer method of the app?

Since the app is basically a single page method, the string query method does not seem to work. At least I have not seen such an example yet ..

Mainly includes 1HTML5 LocalStorage local storage, 2 hidden fields, 3 extended attributes, and 4 server-sideSession, etc.

1HTML5 LocalStorage Local Storage

This method is similar to the cookie method, and is a new standard of html5. In HTML5, local storage is a window attribute, including localStorage and sessionStorage,

The former always exists locally, and the latter is only accompanied by the session. Once the window is closed, it will be gone.

Reference

2. Hide Fields

In PC web programs, hidden fields are often used to store specific information. They can also be used in apps. Of course, there are certain restrictions. values can be transferred in single-page apps, because a single page will eventually become the same dom in the memory, you can set hidden fields in one panel and read hidden fields in another panel.

For example:

                                        
Set the value of hidden fields on the jiekuanshenpi.html page and read the value of hidden fields in jiekuanshenpidetail.html.

3. extended attributes

The restrictions and causes are the same as those for hidden fields.

For example:

The above Code adds an extended property jiekuanshenpiDetailId

On the jiekuanshenpi.html page, set the value of the extended property jiekuanshenpiDetailId,

 $("#jiekuanshenpiDetail").attr("jiekuanshenpiDetailId",id);

Read the value of jiekuanshenpidetail.html.

var jiekuanshenpiDetailId2 = $("#jiekuanshenpiDetail").attr("jiekuanshenpiDetailId"); 
4. Server session

This is basically the same as the text on the PC end, and the value transfer method on the server end can be basically used.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.