pass data from listview to detail view in html app using jquery
i want to pass data from listview to detail view because i want to add button(add to cart) there..there is index page which i have include all the scripts.
here is my code please do let me know where am i wrong
product.js code
$('#myPage').live('pageshow',function(event){
var id = getUrlVars()["cat_id"];
$.getJSON('http://siliconsoftwares.in/store/jsondesc.php?cat_id='+id, function(data) {
//THIS IS NOT WORKING, IS THE SAME AS PUTTING id, not id_localidad
$.each(data.items, function(i, data) {
$('#myView').append( '<li><a href="detailitem.html?cat_id='+ data.products_id + '"><img src="' + data.products_image + '"></img><h3>item type:<span> ' + data.products_model + '</span></h3><p>' + data.products_description + '</p></a></li>');
$('#myView').listview('refresh')
});
});
});
function getUrlVars() {
var vars = [], hash;
var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
for(var i = 0; i < hashes.length; i++)
{
hash = hashes[i].split('=');
vars.push(hash[0]);
vars[hash[0]] = hash[1];
}
return vars;
}
detailpage.js
$('#detailsPage').live('pageshow', function(event) {
var id = getUrlVars()["cat_id"];
$.getJSON('http://siliconsoftwares.in/store/jsondesc.php?cat_id='+id, displayitem);
});
function displayitem(data) {
var items = data.items;
console.log(items);
$('#itemPic').attr('src', '' + items.products_image);
$('#Title').text(items.products_model);
$('#Description').text(items.products_description);
}
detailitem.html
<body>
<div id="detailsPage" data-role="page" >
<div data-role="header">
<a data-role="button" data-rel="back" data-icon="arrow-l" data-theme="b">Back</a>
<h1>Details</h1>
</div>
<div data-role="content">
<img id="itemPic"/>
<h3 id="Title"></h3>
<p id="Description"></p>
<button class="add-to-cart">+ Add to Cart</button>
</div>
</div>
</body>
</body>
here is my url u can check it out
siliconsoftwares.in/html/index.html
please sir help me...been stuck since from 4 days...