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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T19:37:42+00:00 2026-06-15T19:37:42+00:00

So I am making a autocomplete with jquery . Ajax is used to get

  • 0

So I am making a autocomplete with jquery. Ajax is used to get a heavy xml file from remote location. If I search for ex. “Two and a half men” it does about 16 querys (for every letter typed except the 3 first, look the code) with ajax.

I want it to do the Ajax request a second after user has pressed the last key so it will do one query instead of 16.

So if user presses another key before it’s been 1 second since the last keydown event, it won’t do the query yet.

<script>
    $(document).ready(function(){
        $('#tv_search').keydown(function(){
            var search = $(this).val();
            if(search.length >= 3)
            {
                $.ajax({
                  type: "GET",
                  url: "search.php",
                  data: {show : search, key : '890k4900k0ll' }
                }).done(function(msg){
                    $('#t').html(msg);
                });
            }
        });
    });
</script>

Search for series: <input type='text' name='tv_search' id='tv_search'>

Any ideas?

  • 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-15T19:37:43+00:00Added an answer on June 15, 2026 at 7:37 pm

    You could just use a timeout, and clear it every time a key is pressed :

    $(document).ready(function() {
        $('#tv_search').on('keyup', function() {
            clearTimeout($(this).data('timer'));
            var search = this.value;
            if (search.length >= 3) {
                $(this).data('timer', setTimeout(function() {
                    $.ajax({
                        type: "GET",
                        url: "search.php",
                        data: {
                            show: search,
                            key: '890k4900k0ll'
                        }
                    }).done(function(msg) {
                        $('#t').html(msg);
                    });
                }, 1000));
            }
        });
    });​
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am trying to get an autocomplete working and making an Ajax form submission
I am using jquery-ui autocomplete and making a ajax call inside the autocomplete function
Am using ui autocomplete from http://jqueryui.com/demos/autocomplete/#remote Using PHP in search.php to return results. Am
i am using jquery-ui auto-complete and making a ajax call inside the auto-complete function
I am making use of jQuery's .autocomplete plugin, and I would appreciate some assistance
I have a jQuery autocomplete that works fine making the suggestions but when I
Hello I am making a searchbar which would autocomplete, but I do not get
I am making a jQuery autocomplete and I have something between 10~20k registers. The
Ok so I have an autocomplete field heere that is making an ajax request
I just get a strange bug when using those two tools. I'm making an

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.