error with using jQuery-Mobile-Listview-Pagination-Plugin -
error using jquery-mobile-listview-pagination-plugin
i used jquery-mobile-listview-pagination-plugin , had error in js
referenceerror: _getajaxcall not defined [break on error]
var ajaxcallback = _getajaxcall();
my index.html code :
<html> <head> <title>makanak</title> <meta charset="utf-8"/> <meta name='viewport' content='width=device-width, initial-scale=1.0, maximum- scale=1.0 width=device-width, user-scalable=no'/> <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.1/jquery.mobile- 1.3.1.min.css" /> <script src="http://code.jquery.com/jquery-1.9.1.min.js"></script> <script src="http://code.jquery.com/mobile/1.3.1/jquery.mobile-1.3.1.min.js"></script> <script type="text/javascript" src="jquery.mobile.listomatic.js"></script> <script> $(document).on("pageinit", function(){ var serviceurl = "returns-json-numbers.php"; var getnumber = function() { return $.ajax({ type: "post", beforesend: function() { $.mobile.loading( 'show' ) }, //show spinner complete: function() { $.mobile.loading( 'hide' ) }, //hide spinner async: "true", datatype: 'json', url: serviceurl, data: { listomatic: $.mobile.listomatic.prototype.getresults() }, success: function(data) { if (data && data.numbers) { var list = ''; $.each(data.numbers, function(index, value) { list += '<li data-icon="false" data-filtertext="' + value.date + '">' + '<div class="latestnumber">' + '<span class="circle">' + value.number[1] + '</span>' + '</div>' + '<p style="text-align:center;" class="latestnumberdate">' + value.date + '</p>' + '</li>'; }); // end each $('#listview').append(list).listview("refresh"); } // end if } // end success }); // end ajax } $.extend($.mobile.listomatic.prototype.options, {perpage: 2, btnlabel: 'show me more', refreshcontent: 'daily'}); $.mobile.listomatic.prototype.registerajaxcall(getnumber); $.extend($.mobile.listomatic.prototype.options, {perpage: 2, btnlabel: 'show me more', refreshcontent: 'daily', noresultsfound: 'no results found' }); }); </script> </head> <body> <!---------------------------- start home page ----------------------------------------------> <div data-role="page" id="home" > <div data-role="header" data-theme="b"> </div> <div data-role="content"> <ul id="listview" data-role="listview" data-filter="true" data-listomatic="true"></ul> </div><!-- /content --> </div> </body>
my returns-json-numbers.php code :
<?php error_reporting(0); header('access-control-allow-origin: *'); $con=mysqli_connect("localhost","root","","intsys"); if (mysqli_connect_errno()) { echo "failed connect mysql: " . mysqli_connect_error(); } $perpage = $_request['listomatic']['perpage']; $listoffset = $_request['listomatic']['listoffset']; $searchterm = $_request['listomatic']['searchterm']; if ($searchterm) { $sql = "select sql_calc_found_rows * waiting_student_branch_course_details date '%$searchterm%' order id asc limit $listoffset, $perpage"; } else { $sql = "select sql_calc_found_rows * waiting_student_branch_course_details order id asc limit $listoffset, $perpage"; } $result = mysqli_query($con, $sql); // if using mysql use sql_calc_found_rows in main queries (above) // total records available use found_rows() function (below) $resultnumrows = mysqli_query($con, 'select found_rows() foundrows'); $rowfoundrows = mysqli_fetch_array($resultnumrows); $ifoundrows = $rowfoundrows['foundrows']; while($row = mysqli_fetch_array($result)) { $sdate = date('m/d/y', strtotime($row['at_time'])); // listomatic requires "total" field show/hide "show more" button $adata['total'] = $ifoundrows; // following sample data (in case powerball numbers) want display $adata['numbers'][] = array('date' => $sdate, 'number' => array(1 => $row['id'] )); } echo json_encode($adata); exit; ?>
i downloade plugin https://github.com/stakbit/jquery-mobile-listview-pagination-plugin
Comments
Post a Comment