$("#listview").append('<li><a class="item" href="new.html?gname='+ groupName + '&gid='+groupId+'"><img src="../icon.png" /><h4>'+ groupName + ' </h4><p>'+ createdON +'</p></a></li>');
here is data i am passing to next page. How can i get gname and gid variables with passed data on next page?
I'd advice you to use sessionStorage and localStorage.
In your case, In second page (new.html) use the following
$(document).on('pagebeforeshow', "#second",function () {
var parameters = $(this).data("url").split("?")[1];
parameter = parameters.replace("paremeter=","");
alert(parameter);
});
for more detailed explanation have a look at
http://www.gajotres.net/passing-data-between-jquery-mobile-pages/
if you want to go with sessionStorage and localStorage the syntax is pretty simple.
in first page set the items
localStorage.setItem("gName", "GroupName");
localStorage.setItem("gid", "GroupId");
and then in second page get the items
var gname=localStorage.getItem("gName");
var gid=localStorage.getItem("gid");
localStorage is avalible until user clears the cache.if you want it to be temporary use sessionStorage it will cleared as the app is closed.