javascript - onkeyup Event Firing delay -


i have input textbox people enter username, has onkeyup event attribute attached fires off ajax request check if username taken.

  1. what delay between first key second ? meaning if type 5 letter word 1 letter after other. ajax fire 5 times ?

  2. if there no delay, "computationally expensive" since there many database queries ? or there no noticeable difference ?

  3. if there difference in performance, methods take using javascript check if user "done" typing. still want automatically check after typing. ruling out onblur attributes etc.

my code: http://pastebin.com/hxfgk7nl
(code indentation wasn't working me on stack overflow)

yes, fire every key-up event. can reduce performance hit using following approach.

  1. i sure must have minimum character length username. wait until user type number of characters query database.

  2. you bring usernames starting user typed username , process in local memory. may not real time reduce number database queries. depend on size of current user list.

  3. double check existence of username before saving database.


Comments

Popular posts from this blog

Android : Making Listview full screen -

javascript - Parse JSON from the body of the POST -

javascript - Chrome Extension: Interacting with iframe embedded within popup -