jquery mobile - List item to detailed view page
I have a page which contains the list item. I need to fetch the data from my server on list item click and need to show the the detailed data on the second page. For each list item click i need to show different information.
- <!-- First page -->
- <div data-role="page" data-theme="c" id="home-page">
- <div data-role="header" data-iconpos="left">
- <h1>Visit Kerala</h1>
- <a href="#link" data-role="button" data-icon="home" data-iconpos="notext">Home</a>
- </div>
-
- <div data-role="content" data-content-theme="a">
- <ul data-role="listview" data-theme="b" id="indexList">
- <li><a href="#">Pilgrim Centres</a></li>
- <li><a href="#">Waterfalls</a></li>
- <li><a href="#">Wildlife</a></li>
- <li><a href="#">Beaches</a></li>
- <li><a href="#">Houseboats</a></li>
- <li><a href="#">Backwaters</a></li>
- <li><a href="#">Hills</a></li>
- <li><a href="#">Museums</a></li>
- </ul>
- </div>
- </div>
What i am trying to achieve is to put url like this
- <li><a href="getdata.php?id=1">Pilgrim Centres</a></li>
- <!-- Second page -->
- <div data-role="page" data-theme="a" id="page2">
- <div data-role="header" data-iconpos="left">
- <h1>Home title</h1>
- </div>
- <div data-role="content">
- <p> {Title Here} </p>
- <div class="ui-grid-solo">
- <div class="ui-block-a"> { Image here }</div>
- </div>
- <div class="ui-grid-b">
- <div class="ui-block-a"><a href="#" data-role="button">Map</a></div>
- <div class="ui-block-b"><a href="#" data-role="button">Visit</a></div>
- <div class="ui-block-c"><a href="#" data-role="button">Share</a></div>
- </div>
- </div>
- </div>
Every list item need to fetch different data based on a primary key. How can use the ajax call to fetch data from server on list item click.
Someone please suggest me best method to do this type of application ; its a common need for the app.
Thanks
Kiran.