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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T08:28:47+00:00 2026-05-28T08:28:47+00:00

I have a serious problem in my app. I wrote a facebook like instant

  • 0

I have a serious problem in my app. I wrote a “facebook like” instant search:

There is a:

<input id="theinput" type="text" title="New Search"/>

Which appears after i select which category i want to search for, exp: rock, heavy metal, pop, indie… so, depending of which category i click javascript sets it’s name to a variable for the search page to know what table to search in (being each table a category). So part of the javascript is:

$('#rockselector').click(function(){
        fadethings();
        $("#resultdiv").html('<span style="color: #fff; font: 12px Verdana, serif; position: relative; left: 20px; top: 20px;">Search a Rock Artist</span>');
        whichselector = "rock";
        soletsgo();
    });

    //-----------------------------------------------

    $('#heavymetalselector').click(function(){
        fadethings();
        $("#resultdiv").html('<span style="color: #fff; font: 12px Verdana, serif; position: relative; left: 20px; top: 20px;">Search a Heavy Metal Artist</span>');
        whichselector = "heavymetal";
        soletsgo();
    });

The ‘fadethings()’ function will fadeOut the div where you select which category, and it will fadeIn the div which will show the results of the search and the input: ‘theinput’, shown above. The function ‘soletsgo()’ will do the search:

        function soletsgo(){

$('#theinput').keyup(function(){

    function searchy(){
    value = escape($('#theinput').val());

    if ( value.length > 0){
    $("#autodatathing").load("../searchmaster.php?word="+value+"&cat="+whichselector+""); }  

    } // End of searchy() function

            setTimeout(searchy,1000);

    }); // End of keyup function

} // End Of Function soletsgo()

The problem is that when i type something long like: ‘The Jimi Hendrix Experience’, it repeats the searches, even when i change category and search another artists it keeps on doing the last search until its kinda reached the result for every ‘keyup’. I Know what is happening here, but, don’t know what to do. Can anyone help?

  • 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-28T08:28:48+00:00Added an answer on May 28, 2026 at 8:28 am

    The problem is that you are triggering the setTimeout every time the keyup event gets triggered. Which results in an ajax request being made every single keypress.

    Try something like this:

    function soletsgo() {
        var timer, jqXHR, input;
    
        function searchy() {
            var value = escape(input.val());
    
            if (value.length > 0) {
                // Abort the last ajax request becuase we don't care anymore
                if (jqXHR) jqXHR.abort();
                jqXHR = $.ajax({
                    url: "../searchmaster.php",
                    data: {
                        "word": value,
                        "cat": whichselector
                    },
                    success: function(data) {
                        $("#autodatathing").html(data);
                    }
                });
            }
    
        }
    
        input = $('#theinput').keyup(function() {
            // Clear the timer because they are typing more
            clearTimeout(timer);
            timer = setTimeout(searchy, 1000);
        });
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have this serious problem. I have an enumeration within 2 namespaces like this:
I have got a serious problem running our web app in some machines.. machines
So I feel like a serious rookie right now, but I have a problem
I have a serious problem. One of our servers crashed. Now I reinstalled the
I am new to python and I have a serious problem that I cannot
Ok guys, I have a serious problem with this. I have a static class
I am writing ESME using logica smpp lib , but have a serious problem
I have a serious performance problem. I have a database with (related to this
I have a serious problem with calculating Standard Deviation within subgroup in SSRS/SQl (whichever
i have a serious problem here. i'm trying to use a modal window in

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.