Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8404615
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T22:38:38+00:00 2026-06-09T22:38:38+00:00

I have a multipage jquerymobile website with a list on the first page. Each

  • 0

I have a multipage jquerymobile website with a list on the first page. Each element of the list points to a second page which content depends on which list element has been pressed. In the specific I have a alist of “locations” in the first page and the detail of the specific location in the second.

<ul id="location_list" data-role="listview">
    <li><a href="#location_page" data-id="1231">Location 1</a></li>
    <li><a href="#location_page" data-id="4056>Location 2</a></li>
    <li><a href="#location_page" data-id="7569">Location 3</a></li>
</ul>

Where the data-id attribute is the location identifier.
To pass paramenters I added a jQuery function on the list elements which find out the pressed element data-id value and store it int a variable in the window variable before calling the next page.

$('#location_list').find("a").live("click",function(event){
    window.location_id = $(this).data("id");
});

The second page will read the value in window.location_id and show the right content.

Everything works fine until I refresh the second page. If I do that the variable I used to pass the paramenters is (correctly) empty and nocontent is loaded.
I tried to pass the value in the URL of the page (linking the list with href=”#location_page?locid=1231″) and parse the document.location value but it does not work on page to page itaration (if I print the URL the second page has I have just “#location_page” instead of “#location_page?locid=1231”)

Can anyone help me solving my problem? Maybe with a better way to pass paramenters between pages or a way to make post passing paramenters works.

Thanks for your help.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T22:38:39+00:00Added an answer on June 9, 2026 at 10:38 pm

    There is a better way of passing the parameters.

    jQuery.data() works by attaching the data to the DOM (like you did with id: <a ... data-id=""></a>). Because jQuery Mobile never refreshes and uses AJAX for page switching, that data is available throughout your mobile application/website, but once a page refreshes, the DOM is reloaded and it knows nothing about the data that was previously attached.

    What I believe you should do is the following. Create a locations.html page for the list and a location-details.html page for a specific location’s details. Then you could easily pass the data through the URL.

    Example:

    <!-- locations.html -->
    ...
    <ul id="locations_list" data-role="listview">
        <li>
            <a href="location-details.html?id=1">Location 1</a>
        </li>
        <li>
            <a href="location-details.html?id=2">Location 2</a>
        </li>
        <li>
            <a href="location-details.html?id=3">Location 3</a>
        </li>
        <li>
            <a href="location-details.html?id=4">Location 4</a>
        </li>
        <li>
            <a href="location-details.html?id=5">Location 5</a>
        </li>
    </ul>
    ...
    
    <!-- location-details.html -->
    ...
    <script type="text/javascript">
        $(document).on('pageinit', function () {
            function setupLocationDetails () {
                var location_id = $.mobile.path.parseUrl($(location).attr('href')).search.replace('?id=', '');
    
                // Do whatever you need to do here.
            }
    
            setupLocationDetails();
        });
    </script>
    ...
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a program which prints a multi-page document. The first page is pre-printed
I have a multipage application which needs to manually switched from one page to
I have an application that has many cases. Each case has many multipage tif
I have a question on managing a multipage GWT website. For now I only
I had a scanned multipage TIFF image and needed to split each page out
I have a form which has about 40 fields.What are the effective patterns to
I have a multipage design with jquery mobile. On the first site i call
I have a multipage reporting services report, and i would like to start from
Problem: I have a multipage TIFF image (generated with tiffutil) that contains the same
As an Actionscript programmer shifting to JS/jQuery I often have to author multipage apps

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.