Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $("select#opt-category").change(function () {
- $(".showgrid").load('portal.php?category='+category);
- });
- if(isset($_GET['category'])) $catgory=$_GET['category'];
- <script type="text/javascript">
- function loading_show(){
- $('#loading').html("<img src='assets/img/ajax-loader.gif'/>").fadeIn('slow');
- }
- function loading_hide(){
- $('#loading').fadeOut('slow');
- }
- function loadData(page,category){
- loading_show();
- $.ajax
- ({
- type: "POST",
- url: "pagination_data.php",
- data: {'page':page,'category':category},
- success: function(msg)
- {
- $("#container").ajaxComplete(function(event, request, settings)
- {
- loading_hide();
- $("#container").html(msg);
- });
- }
- });
- }
- loadData(1,<?php echo $catgory?> )
- // For first time page load default results
- $('#container .pagination li.active').live('click',function(){
- event.stopPropagation();
- var page = $(this).attr('p');
- var category= $(this).attr('q');
- loadData(page,category);
- //break;
- });
- $('#go_btn').live('click',function(){
- var page = parseInt($('.goto').val());
- var category = parseInt($('.total').attr('b'));
- var no_of_pages = parseInt($('.total').attr('a'));
- if(page != 0 && page <= no_of_pages){
- loadData(page,category);
- }else{
- alert('Enter a PAGE between 1 and '+no_of_pages);
- //$('.goto').val("").focus();
- return false;
- }
- });
- </script>
- $('#container').on('click', '.pagination li.active', function(){…});
- $('#container').on('click', '#go_btn', function(){…});
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement