jQuery Multi-page not working when navigated from another page.
Hi,
I have 3 PHP files.
In
index.php file, I have a search box, like;
- <div role="main" class="ui-content jqm-content">
- <h1 style="text-align: center">Logo</h1>
- <form action="search.php" method="get">
- <div data-demo-html="true">
- <input type="search" placeholder="Enter keyword" name="search" id="search" value="">
- </div>
- <div data-demo-html="true">
- <fieldset data-role="controlgroup">
- <button class="ui-shadow ui-btn ui-corner-all" type="submit" name="kw">Search</button>
- </fieldset>
- </div>
- </form>
- </div>
The second page, where search results are displayed, is like;
- <div role="main" class="ui-content jqm-content">
- <ul data-role="listview" data-inset="true">
- <li data-role="list-divider">Showing results<span class="ui-li-count">2</span></li>
- <?php
- while($row = mysql_fetch_array($result)){ //loop to create list view
- ?>
- <li class="drug">
- <a href="view.php?id=<?php echo $row['id']; ?>" style="border-bottom: none">//Link to next page
- <p><strong>Name: </strong><?php echo $row['name']; ?></p>
- <p><strong>Age: </strong><?php echo $row['age']; ?></p>
- </a>
- </li>
- <?php } ?>
- </ul>
- </div>
This code creates links to next page like view.php?id=1234 , view.php?id=2345 etc.
The page "view.php" is like;
- <div data-role="page" id="one">
<div role="main" class="ui-content">
<p><strong>Name : </strong>Some Name</p>
<p><strong>Age : </strong>Some Age</p>
<p><a href="#two" class="ui-btn ui-shadow ui-corner-all">Show more information</a></p>
</div>
</div>
<div data-role="page" id="two" data-theme="a">
<div role="main" class="ui-content">
<p><strong>Address : </strong>Address</p>
<p><a href="#one" data-direction="reverse" class="ui-btn ui-shadow ui-corner-all ui-btn-b">Back</a></p>
</div>
</div>
I have included just the relevant pieces of code. My problem is that, everything works like charm, that is, I can search, I can see the list view, and when I click the link, I lands on view.php page, where I can see the name and age info. Its a multi page template. When I click the button "Show more information" , then nothing is happening. The Address part or the other div is not showing. But if I reload the page or manually go to "view.php?id=1234", then everything is alright and I can see the second div or the Address part. But If i navigate from search box (index.php), to result page (search.php), and from search result to the final page (view.php), then it is not working. How can I fix this? Please help me.
Thanks in advance.