Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2019
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.19 KB | None | 0 0
  1. $("select#opt-category").change(function () {
  2. $(".showgrid").load('portal.php?category='+category);
  3.  
  4. });
  5.  
  6. if(isset($_GET['category'])) $catgory=$_GET['category'];
  7.  
  8.  
  9. <script type="text/javascript">
  10.  
  11. function loading_show(){
  12. $('#loading').html("<img src='assets/img/ajax-loader.gif'/>").fadeIn('slow');
  13. }
  14. function loading_hide(){
  15. $('#loading').fadeOut('slow');
  16. }
  17. function loadData(page,category){
  18. loading_show();
  19.  
  20. $.ajax
  21. ({
  22.  
  23. type: "POST",
  24.  
  25. url: "pagination_data.php",
  26. data: {'page':page,'category':category},
  27.  
  28. success: function(msg)
  29. {
  30. $("#container").ajaxComplete(function(event, request, settings)
  31. {
  32. loading_hide();
  33. $("#container").html(msg);
  34. });
  35. }
  36. });
  37. }
  38.  
  39.  
  40. loadData(1,<?php echo $catgory?> )
  41. // For first time page load default results
  42. $('#container .pagination li.active').live('click',function(){
  43. event.stopPropagation();
  44. var page = $(this).attr('p');
  45. var category= $(this).attr('q');
  46.  
  47. loadData(page,category);
  48.  
  49. //break;
  50.  
  51. });
  52.  
  53. $('#go_btn').live('click',function(){
  54. var page = parseInt($('.goto').val());
  55. var category = parseInt($('.total').attr('b'));
  56.  
  57.  
  58. var no_of_pages = parseInt($('.total').attr('a'));
  59. if(page != 0 && page <= no_of_pages){
  60. loadData(page,category);
  61. }else{
  62. alert('Enter a PAGE between 1 and '+no_of_pages);
  63. //$('.goto').val("").focus();
  64. return false;
  65. }
  66.  
  67. });
  68.  
  69. </script>
  70.  
  71. $('#container').on('click', '.pagination li.active', function(){…});
  72.  
  73. $('#container').on('click', '#go_btn', function(){…});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement