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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T04:40:45+00:00 2026-05-20T04:40:45+00:00

I am trying to make a filtering where a user would search by last

  • 0

I am trying to make a filtering where a user would search by last name. Right now I have it on keypress but of course this does too many ajax requests so I would rather have it after a few keys or something like that.

I am return all the results as a table(I have a partial view that generates a table with the info in it)

 $(function ()
    {
        $('#LastName').keypress(function ()
        {

            $.post('ActionMethod', { 'lastName': $(this).val() }, function (response)
            {
                $('#results').html(response);
            });
        });
    });

Any ideas how I should do this. I guess the logic would be similar to a auto complete and I know they can set like how many keystrokes before you query db.

  • 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-20T04:40:45+00:00Added an answer on May 20, 2026 at 4:40 am

    I think you should just use timeouts and delay the execution of the ajax call. If a keypress occurs before the execution then reset the timer…

    $(function ()
        {
            var timer;
            $('#LastName').keypress(function ()
            {
                var _this = this; // we need to store the this to a variable since it will be called out of context from the timeout
                clearTimeout(timer);
                timer = setTimeout(function(){
                             $.post('ActionMethod', { 'lastName': $(_this).val() }, function (response)
                             {
                                 $('#results').html(response);
                             });
                           }, 500); // delay for 500 milliseconds
            });
        });
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Trying to make simple minesweeper game in python, but have one problem. I have
im trying make one replace in string from a array but this dont work
I have spent the whole day trying to make my application use threads but
Trying to make a simple program to catalogue books. Something like this, for example:
Trying to make a simple program to catalogue books. Something like this, for example:
I am trying to write a SQL Server query but have had no luck
I have been trying to make a list box report parameter with multiple choice
I am trying make a segue call in a tableview , but the application
I am trying to make a search view in Django. It is a search
trying to make 5 curl childs for curl handler and defining them, but can't

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.