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 8099263
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T22:21:00+00:00 2026-06-05T22:21:00+00:00

I have a search page which uses a simple ajax request to get new

  • 0

I have a search page which uses a simple ajax request to get new search results from the controller.

The controller returns the results as rendered html, so all the client script has to do is $(‘#results’).html(data);

The html also contains paginated links.

I want to add click handlers to these paginated links inside the ajax success event handler, but I find it kind of icky to be getting the page number from the A’s text property.. hypothetically, the links could read “Page 1”, “Page 2”, and then i’d be parsing text.

Am I doing this wrong?

Should I be generating the ajax links inside the partial view instead?

  • 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-05T22:21:03+00:00Added an answer on June 5, 2026 at 10:21 pm

    The page number can be stored as data for a element. You can refer to that data in hooking up your event handlers. Traditionally–i.e. in my old applications–I would do it like this:

    <a href="#" name="myLink" data="<%: [pageNumber] %>">
      Page <%: [pageNumber] %>
    </a>
    

    Then on the jquery side (i.e., ajax callback):

    $('a[name=myLink]').click( function (e) {
      e.preventDefault();
      var pageNumber = $(this).attr('data');
      // do what you have to do with the pageNumber
    });
    

    But you can (and should) refer to the jQuery data function if you are going down this route.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have xpath page.search(//table[@class='campaign']//table) which returns two tables. I need to choose only first
I have a search page which finds candidates. From this page you can click
In my app I have an advanced search page which uses a tableview with
We have a page calling a Search stored procedure which internally uses SQL Server
I have the following scenario. I have a search page which is split into
I have a search page in which I am searching data by passing multiple
I have a search page that if there is results in the list it
i have this MySQL statement from a search page, the user enters there postcode
I have a PHP search suggestion script which uses a MySQL database as its'
I have a web page that returns over 36000 items from sql server and

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.