0

I'm developing mobile app with jquery mobile, and I find it hard to retrieve the data passed from page one to page two.

Here's the answer to a similar question: jQuery Mobile: Get data passed to page via changePage

But the solution is not quite clear, I still have some confusion:

  1. Why do I need to specify the data I want to pass in both dataUrl and data option? It's obviously redundant and confusing.
  2. If I need to retrieve data from dataUrl on second page, why bother to specify data option on the first page?????
  3. I did some tests, I can't find the data option passed to anywhere in the pagebeforeshow event handler of second page. It's not in event object, it's not in data object. Then where does the data option go? If it's not passed, why to specify it???

It's really confusing, please somebody with experience help!!

Community
  • 1
  • 1
Aaron Shen
  • 8,124
  • 10
  • 44
  • 86
  • 1
    I dont know, but if you want to pass a data from page to page, you can add parameters to the second link and get it onload OR you can just use localStorage. – kenicky Jun 12 '14 at 03:22
  • @kenicky, it doesn't work for me that add parameters to the link. The two pages I have them in the same html file. I don't know if that causes the problem. I know I can store the data in the localstorage, but I just don't think that's a nature way to pass data in navigation. – Aaron Shen Jun 12 '14 at 03:37
  • Use session storage. It keeps the data until the window/app is closed. – Alkis Kalogeris Jun 12 '14 at 04:05

0 Answers0