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

  • SEARCH
  • Home
  • 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 698137
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:14:31+00:00 2026-05-14T03:14:31+00:00

Here is function , <script type=text/javascript> $(document).ready(function() { getRecordspage(1, 5); $(a.page-numbers).click(function() { alert(1); getRecordspage($(this).text(),

  • 0

Here is function ,

 <script type="text/javascript">
    $(document).ready(function() {
        getRecordspage(1, 5);
        $("a.page-numbers").click(function() {
            alert(1);
            getRecordspage($(this).text(), 5);
            return false;
        });
    });

And in my page i am appending anchors dynamically to this div,

<div id="pager" class="pager">
//my anchors will be present here...
</div>

i am appending anchors dynamically… All anchors will have class="page-numbers"… How it can be done…

When inspected through firebug my pager div had this when i clicked 3,

<div class="pager" id="pager">
<a class="page-numbers prev" href="#">Prev</a>
<a class="page-numbers" href="#">1</a>
<a class="page-numbers" href="#">2</a>
<span class="page-numbers current">3</span>
<a class="page-numbers" href="#">4</a>
<a class="page-numbers next" href="#">Next</a></div>

EDIT:

I using jquery 1.4…

function getRecordspage(curPage, pagSize) {
    $.ajax({
        type: "POST",
        url: "Default.aspx/GetRecords",
        data: "{'currentPage':" + curPage + ",'pagesize':" + pagSize + "}",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(jsonObj) {
            var strarr = jsonObj.d.split('##');
            var jsob = jQuery.parseJSON(strarr[0]);
            var divs = '';
            $.each(jsob.Table, function(i, employee) {
                divs += '<div class="resultsdiv"><br /><span class="resultName">' + employee.Emp_Name + '</span><span class="resultfields" style="padding-left:100px;">Category&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.Desig_Name + '</span><br /><br /><span id="SalaryBasis" class="resultfields">Salary Basis&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.SalaryBasis + '</span><span class="resultfields" style="padding-left:25px;">Salary&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.FixedSalary + '</span><span style="font-size:110%;font-weight:bolder;padding-left:25px;">Address&nbsp;:</span>&nbsp;<span class="resultfieldvalues">' + employee.Address + '</span></div>';
            });
            $("#ResultsDiv").append(divs);
            $(".pager").pagination(strarr[1], { 
                current_page: curPage - 1, items_per_page: '5', num_display_entries
: '5', next_text: 'Next', prev_text: 'Prev', num_edge_entries: '1'
            });
            $(".resultsdiv:even").addClass("resultseven");
            $(".resultsdiv").hover(function() {
                $(this).addClass("resultshover");
            }, function() {
                $(this).removeClass("resultshover");
            });
        }
    });
  • 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-05-14T03:14:31+00:00Added an answer on May 14, 2026 at 3:14 am

    Use .live():

    $("a.page-numbers").live('click',function() {
            alert(1);
            getRecordspage($(this).text(), 5);
            return false;
    });
    

    or execute your handler assignment after you created the links. If there are no elements with class page-numbers when this function is executed then of course nothing happens.

    But live() takes care of that:

    Description: Attach a handler to the event for all elements which match the current selector, now or in the future.

    Update:

    Well I am not sure. One thing you can try is to move your function inside the success function of the Ajax call:

    function getRecordspage(curPage, pagSize) {
        $.ajax({
            type: "POST",
            url: "Default.aspx/GetRecords",
            data: "{'currentPage':" + curPage + ",'pagesize':" + pagSize + "}",
            contentType: "application/json; charset=utf-8",
            dataType: "json",
            success: function(jsonObj) {
                // .. lot of stuff here..
                // at  the end:
                $("a.page-numbers").click(function() {
                    alert(1);
                    getRecordspage($(this).text(), 5);
                    return false;
                }
           }
       });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this simple function: <script type=text/javascript> //<![CDATA[ jQuery(function($){ function here(b){alert(b);} ; here(6); });
Here is my script: <script type=text/javascript> $(document).ready(function () { $(.div_question).toggle(function () { var answer=
here is my code.. <script type=text/javascript> function clicker(){ var thediv=document.getElementById('downloadoverlay'); if(thediv.style.display == none){ thediv.style.display
Here's my code <script type=text/javascript> function getNextScroll(i){ <asp:Literal ID=infiniteScrollTableJS runat=server></asp:Literal> } </script> I am
Here is the Javascript I currently have <script type=text/javascript> $(function() { $('.slideshow').hover( function() {
I am trying to call a java script function from java code. Here is
I have the following script $(function(){ $('.input1_class, .input2_class, <many other input classes go here>').bind('change',
Here is an example: $(function() { $('#test').change(function() { $('#length').html($('#test').val().length) }) }) <script src=https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js></script> <textarea
Here is my code: <script> function loadPage() { function sendFormHelper(callback) { var url =
How I can load the Google maps like this: function loadScript() { var script

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.