I am using the pagination plug-in provided by jQuery.com however I had a problem putting the content inside probably because my input data is not static html page like the demo.
In the demo the sample input is in static html page and it will get the page based on <div class="result"></div> I have an php output of 5x10 array eq: <div class = "result"> echo $php_poll->view_ten_poll_list(); </div> This does not giving me any correct output, just give me the correct page number but does not give any output. Please help me out, what should I do? /** * Callback function that displays the content. * * Gets called every time the user clicks on a pagination link. * * @param {int}page_index New Page index * @param {jQuery} jq the container with the pagination links as a jQuery object */ function pageselectCallback(page_index, jq){ var new_content = $('#results div.result:eq('+page_index+')').clone(); $('#poll_div').empty().append(new_content); return false; } /** * Callback function for the AJAX content loader. */ function initPagination() { var num_entries = $('#results div.result').length; // Create pagination element $("#Pagination").pagination(num_entries, { num_edge_entries: 2, num_display_entries: 10, callback: pageselectCallback, items_per_page:1 }); } // Load HTML snippet with AJAX and insert it into the Hiddenresult element // When the HTML has loaded, call initPagination to paginate the elements //$(document).ready(function(){ // $('#hiddenresult').load('/listing.php', null, initPagination); //}); function showPolls(){ $("#results").html("<center><img src='/image/grid-loading.gif'></ center>"); $("#results").load('listingpage.php', function(){$(this).hide().fadeIn ('slow');}); //echo "I am here"; } function getPoll(pollid){ $("#poll_div").html("<center><img src='/image/grid-loading.gif'></ center>"); $.getScript('omypoll.php?data=js&poll_ident='+pollid); if ($("#results").css("width") != "100%"){ $("#poll_div").hide().fadeIn("slow"); }else{ $("#poll_div").hide(); $("#results").animate({width: "535px"},1000, "linear", function(){ $("#poll_div").fadeIn("slow"); } ); } } $(document).ready(function() { //showPolls(); $('#results').load('listingpage.php', null, initPagination); }) </script> while my listingpage looks like: <div id="listing"> <table id="tablelist" stripe="true" cellpadding="0" cellspacing="0"> <thead> <tr> <th width="10%">Date</th> <th>Title</th> <th>Votes</th> <!--<th width="5%"><img src="/image/comments.png" title="Comments"></ th>--> <th>Comments</th> <th>Expiry</th> </tr> </thead> <tbody> <div class="result"> <?php $poll_path = dirname(__FILE__); require_once $poll_path."/include/config.inc.php"; require_once $poll_path."/include/$POLLDB[class]"; require_once $poll_path."/include/class_poll.php"; require_once $poll_path."/class_pollcomment_page.php"; require_once $poll_path."/class_plist_page.php"; $CLASS["db"] = new polldb_sql; $CLASS["db"]->connect(); /* poll list */ $php_poll = new plist(); $php_poll->set_template("poll_list"); $php_poll->set_date_format("d-m-Y"); //$php_poll->set_polls_per_page(10); //echo "\n"; //echo "Total polls: \n"; //echo $php_poll->get_total_polls(); //$php_poll->get_list_pages(); //printf("<div class="result">%s</div>", $php_poll->view_ten_poll_list (); echo $php_poll->view_ten_poll_list(); ?> </div> </div> </tbody> </table> </div> I could output the result but it seems that I can't put it into comment may be I should create from php files into static html? Here is the sample output that works from the demo: <div class="result"><p>Globally maximize granular "outside the box" thinking vis-a-vis quality niches. Proactively formulate 24/7 results whereas 2.0 catalysts for change. Professionally implement 24/365 niches rather than client-focused users.</p> <p> Competently engineer high-payoff "outside the box" thinking through cross functional benefits. Proactively transition intermandated processes through open-source niches. Progressively engage maintainable innovation and extensible interfaces.</p> </div> every <div class="result"></div> will represent a page.