Below is my javascript in nextPage.js
. When I click on it, it must pass category_id
to the reportlist.html
page. Please help me.
var base_url = "http://dev.edfutura.com/nithin/jps/edfuturaMob/";
$(document).on("pageinit", "#catlist", function() {
var submitUrl = base_url+"categorylist/get_categorylist";
$.ajax({
url: submitUrl,
dataType: 'json',
type: 'POST',
success: function(response) {
var categoryList = $('#category');
var category;
for(var i = 0, len = response.length; i < len; i++) {
category = response[i];
var a = $('<a>').attr('href', 'reportlist.html').html(category.category_name);
categoryList.append($('<li>').attr('id', category.category_id).append(a));
}
},
error: function() {
alert("error");
}
});
My first page is nextPage.html
and my category_names
are stored in a list as links through JS.
<body id="category_id">
<div data-role="page" id="catlist">
<div id="loading"></div>
<div data-role="header" data-position="fixed" data-theme="b">
<h1>category</h1>
</div>
<div data-role="main" class="ui-content">
<form id="nextForm" >
<ul data-role="listview" data-inset="true" id="category">
<li id="catid"></li>
</ul>
</form>
</div>
</div>
</body>