Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8529585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T09:03:54+00:00 2026-06-11T09:03:54+00:00

I have a pagination page based on dropdown list and on change loaded as

  • 0

I have a pagination page based on dropdown list and on change loaded as

$("select#opt-category").change(function () {
                    $(".showgrid").load('portal.php?category='+category);

                    });

in portal.php(which is also post as ajax to pagination.php

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>

It shows all the pagination correctly but clicking on pages fire multiple Ajax call to pagination_data.php and how do i change to .on()

thanx

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-11T09:03:55+00:00Added an answer on June 11, 2026 at 9:03 am

    Use the element closest to the button, which is not loaded dynamically (document in extreme cases). Then attach the handler on it, and use the button’s selector (the id in your case) as the selector for the delegated event.

    Assuming your #container is that static element:

    $('#container').on('click', '.pagination li.active', function(){…});
    
    $('#container').on('click', '#go_btn', function(){…});
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I currently have pagination functionality that displays the total page count, but I was
I have an application with associations and will pagination the pages. The index page
I have a page where I have 4 tabs displaying 4 different reports based
I have a dataTable that uses pagination. Now when my page loads then my
I have a PHP-based pagination system and it is working fine, I'm using GET
HI i have a working php based pagination which works fine, but when i
I have this route defined: $route['search/(:any)/(:num)/(:num)/(:num)/(:num)'] = home/results/$1/$2/$3/$4/$5; and my pagination in results() function:
Let's say I have a list of 15 anchor tags (for pagination of an
I have 10 pages of contents with the pagination object on each page done
I am developing an eshop .At products page based on category i putted some

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.