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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T17:16:32+00:00 2026-05-17T17:16:32+00:00

I’m having some problems with an ajax autocomplete field. I did the same thing

  • 0

I’m having some problems with an ajax autocomplete field. I did the same thing before but never ran into problems as I never really had a slow internet connection.

I have an input box which acts as an auto-complete field. I binded a jQuery keyup() event to that field and I’m querying a php file with each keypress on that field, returning a list of 20 matching elements. Altough the return data has only ~2-3kb at most, if I start typing faster, sometimes calls don’t return in the order they were called.

Say I’m searching for “stackoverflow”. It happens sometimes that the final list I get when I already typed “stack” is “st” which would bring more matches than needed. Is there any way to make sure the last call I get is the actual final one?

What I was thinking of was making sure the new data is smaller or at least equal to the data I has before, but I’m thinking this would be to much.

The data I’m querying comes from the Facebook Open graph, namely a json object like http://graph.facebook.com/100000530820249/friends (if you have a Facebook account, you could try http://graph.facebook.com/me/friends if you need authentification for my list).

I really need to fetch the data server-side for some processing so a purely JS method is out of the question. The solution should work for only making sure ajax calls don’t overlap…

Thanks in advance everybody!

  • 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-17T17:16:33+00:00Added an answer on May 17, 2026 at 5:16 pm

    My suggestion would be have the autocomplete perform the $.get() based on a timer. When a user performs a keyup, start a timeout (say 1sec for arguments sake) which when finished, triggers the update. On the keydown event, cancel the timeout. This means that if the user is typing quickly then it will only trigger when they stop/pause.

    I’ll admit this is not ideal, but it should get you on the right track.

    Also, another option is to use the jQueryUI AutoComplete widget: http://jqueryui.com/demos/autocomplete/

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

Sidebar

Related Questions

No related questions found

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.