Advertisement
dotphp

paging

Dec 17th, 2014
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.23 KB | None | 0 0
  1. var fkim = $.noConflict(true);
  2.     function setDate(){
  3.         fkim(document).ready(function() {
  4.             function loading_show(){
  5.                 fkim('#loading').html("<img src='../images/loading.gif' />").fadeIn('fast');
  6.             }
  7.             function loading_hide(){
  8.                 fkim('#loading').fadeOut('fast');
  9.             }
  10.             function loadData(page){
  11.                 loading_show();
  12.                 fkim.ajax({
  13.                     type:"POST",
  14.                     url:"load_bukumasuk.php",
  15.                     data: "page="+page,
  16.                     success: function(msg)
  17.                     {
  18.                         fkim("#container2").ajaxComplete(function(event, request, settings) {
  19.                             loading_hide();
  20.                             fkim("#container2").html(msg);
  21.                         });
  22.                     }
  23.                 });
  24.             }
  25.             loadData(1); //for first time page load defaults results
  26.             fkim('#container2 .pagination li.active').live('click', function(){
  27.                 var page = fkim(this).attr('p');
  28.                 loadData(page);
  29.             });
  30.             fkim('#go_btn').live('click', function(){
  31.                 var page = parseInt(fkim('.goto').val());
  32.                 var no_of_pages = parseInt(fkim('.total').attr('a'));
  33.                 if(page !=0 && page <= no_of_pages){
  34.                     loadData(page);
  35.                 }else{
  36.                     alert ('Silakan input halaman antara 1 sampai '+no_of_pages);
  37.                     fkim('.goto').val("").focus();
  38.                     return false;
  39.                 }
  40.             });
  41.         });
  42.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement