Advertisement
Guest User

Untitled

a guest
Jun 16th, 2019
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.51 KB | None | 0 0
  1. <script>
  2. $(document).ready(function(){
  3. load_data();
  4. function load_data(page)
  5. {
  6. $.ajax({
  7. url:"pagination2.php",
  8. method:"GET",
  9. data:{page:page},
  10. success:function(data){
  11. $('#page').html(data);
  12. //alert('Successfully called');
  13. },
  14. //error:function(exception){alert('Exeption:'+exception);}
  15. })
  16. }
  17. //load_data(1);
  18.  
  19. $(document).on('click', '.pagination_link', function(){
  20. var page = $(this).attr("id");
  21. load_data(page);
  22. });
  23.  
  24.  
  25. });
  26. </script>
  27.  
  28. if($page_nb > 1) {
  29. //echo "<a href='index_all.php?page=".$prev_page."'>Back</a>";
  30. echo "<span class='pagination_link' style='cursor:pointer;' id='".$prev_page."'>Back</span>";
  31.  
  32. }
  33.  
  34. if ( $products_count > $check ) {
  35.  
  36. for ( $i = max( 1, $page_nb - 5 ); $i <= min( $page_nb + 5, $limit ); $i++ ) {
  37. if ( $current_page == $i ) {
  38. echo "<span class="selected">{$i}</span>";
  39. } else {
  40. //echo "<a href="{$url}?page=" . $i . "">{$i}</a>";
  41. echo "<span class='pagination_link' style='cursor:pointer;' id='".$i."'>".$i."</span>";
  42. }
  43. }
  44. }
  45.  
  46.  
  47.  
  48. if ($products_count > $check) {
  49.  
  50. $next_page = $page_nb + 1;
  51. //echo "<a href='index_all.php?page=".$next_page."'>Next</a>";
  52. echo "<span class='pagination_link' style='cursor:pointer;' id='".$next_page."'>Next</span>";
  53.  
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement