Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Well, this is my way and works very good.</p> <p>HTML</p> <pre><code>&lt;div data-role="page" id="myPage"&gt; &lt;div data-role="content" id="myContent"&gt; &lt;ul data-role="listview" data-inset="true/false/whatever" id="myList"&gt;&lt;/ul&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Javascript</p> <pre><code>$("#myPage").live("pageshow",function(event){ // get your id from LINK and parse it to a variable var json_list_callback = getUrlVars()[id]; // verify the URL id if (json_list_callback === '') {json_list_callback === ''} //or what value you want // define your path to JSON file generated by the ID declared upper var json_URL = 'http://your.path.to.json.file.php.json?id=' + json_list_callback; // get the JSON data defined earlier and append to your LIST $.getJSON(json_URL,function(data){ var entries = data; //populate our list with our json data $.each(entries,function(index,entry){ // i use dummy data here, you can have whatever you want in youre json $("#myList").append( '&lt;li&gt;' + // remember that this "page.html?id=' + entry.json_id + '" will be the link where getUrlVars will get the id declared earlier in function '&lt;a href="page.html?id=' + entry.json_id + '"&gt;' + entry.json_title + '&lt;\/a&gt;' + '&lt;\/li&gt;' ); }); //must refresh listview for layout to render $("#myList").listview("refresh"); }); }); //this function gets from URL the id, category, whatever you declare like this: getUrlVars()['id'] or getUrlVars()['category'] after last symbol of "?" // you can define your own symbol with this function function getUrlVars() { var vars = [], hash; var hashes = window.location.href.slice(window.location.href.lastIndexOf('?') + 1).split('&amp;'); for (var i = 0; i &lt; hashes.length; i++) { hash = hashes[i].split('='); vars.push(hash[0]); vars[hash[0]] = hash[1]; } return vars; } </code></pre> <p>This works for me like a charm and i'm using it very often!</p>
    singulars
    1. This table or related slice is empty.
    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. This table or related slice is empty.
    1. 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