Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>The <code>data-url</code> attribute is used to track the origin of the page element. If it is not explicitly set, the pages embedded within the main application document all have their <code>data-url</code> attribute equal to the page <code>id</code>. The only exception to this is the first-page in the document. When you're requesting a page, then jQuery Mobile firstly tries to locate a page with a matching <code>data-url</code> in DOM. If it does not find a such page then it performs an Ajax request and loads the new page in DOM.</p> <p>You can solve the issue using one of the below 3 ways:</p> <p>Use the below code to remove the second page from DOM when you're moving to another page.</p> <pre><code>$(document).on('pagehide', '#second-page', function(event, ui){ $(event.target).remove(); }); </code></pre> <p>This way when you're moving to the first page, the second page will be removed from DOM and your issue will be solved.</p> <p><strong>OR</strong>:</p> <p>Use:</p> <pre><code>$.mobile.changePage('car-details.html', { data: { id: this.id } }); </code></pre> <p>without using the <code>dataUrl</code> setting.</p> <p>This creates a URL: ../car-details.html?id=my_val</p> <p>On refresh the URL remains the same so you can still get the parameters and the <code>data-url</code> is the same as the page id.</p> <p><strong>OR</strong></p> <p>Before <code>changePage()</code> check whether a page with <code>data-url</code> equal to the second page's id exists in DOM and remove it manually.</p> <pre><code>if ($("#second-page-id").length &gt; 0 &amp;&amp; $("#second-page-id").attr("data-url") === 'second-page-id' ) { console.log('remove from DOM'); $("#second-page-id").remove(); } </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload