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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 5, 20262026-06-05T09:20:02+00:00 2026-06-05T09:20:02+00:00

Here’s my code: $(#hifind-find).keyup(function(){ var val = $(this).val(); if (val.length > 1) { var

  • 0

Here’s my code:

$("#hifind-find").keyup(function(){

  var val = $(this).val();

  if (val.length > 1) {
    var posturl = '/hifind/jquery_ui/autocomplete/'+val;

    $.post(posturl, function(r) { 

      $("#hifind-find").autocomplete({
        source: r,
        delay: 50,
        minLength: 2
      });

      $("#hifind-find").bind('autocompleteselect', function(){
        alert('test');
      });

    }, "json");
  }

});

I type a letter in the #hifind-find field. As expected, nothing happens because the val isn’t greater than 1 yet. I type a second character. As expected, the post fires and the response in firebug is what I would expect. But the jquery ui plugin does not show the matching items below the field. If I then backspace once and then type the second character again, the post fires again and this time the options are presented. The results are always presented the second consecutive time an identical search is conducted. So…

  1. ba (no options presented)
  2. Backspace twice, and then…
  3. ba (“banana” is presented as an option, and “babe ruth”, etc).

But, if I reload, and then…

  1. ba (nothing presented)
  2. ap (nothing presented)
  3. ba (nothing presented)
  4. ap (nothing, and so on until I do the same search twice consecutively)

I can see in firebug that the response from the callback is the same every time, and contains the right data.

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-05T09:20:04+00:00Added an answer on June 5, 2026 at 9:20 am

    You’re doing it all wrong. Instead of binding to keyup yourself you should supply a callback to the autocomplete search field.. This way the autocomplete will do caching and what not for you.

    See this post: http://jqueryui.com/demos/autocomplete/#remote-with-cache

    For how to better use the autocompleter.

    In your example it would look like this:

          $("#hifind-find").autocomplete({
            source: function(request, response) {
              var posturl = '/hifind/jquery_ui/autocomplete/'+request.term;
              $.post(posturl, function(data) { 
                 response(data);
              }, "json");
             },
            delay: 50,
            minLength: 2
          });
    
          $("#hifind-find").bind('autocompleteselect', function(){
            alert('test');
          });
    

    I suggest you add a cache to that as described in the post I linked to.

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

Sidebar

Related Questions

here is code: <script type=text/javascript> function doit(){ $('table td').each(function () { if ($(this).text().trim() !=
Here is an example. foreach (var doc in documents) { var processor = this.factory.Create();
Here is the code: Function getData(ByVal id As String) Dim reader As SqlClient.SqlDataReader Dim
Here is the code for the relevant function: def populateSubscribers(csvfile, db): conn = sqlite3.connect(db)
here is my php code $titikPetaInti = array(); while($row = mysql_fetch_assoc($hasil2)) { $titikPetaInti[] =
Here's a piece of code I copied from http://www.schillmania.com/content/projects/javascript-animation-1/demo/ Very simple JS animation: function
Here is the code I'm using inside my AsyncTask DefaultHttpClient httpClient = new DefaultHttpClient();
Here is a code snippet I was working with: int *a; int p =
Here is my program to find all the subsets of given set. To solve
here's my code private void make_Book(int x, int y, string name) { #region Creating

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.