What I’m currently doing is using jQuery to perform an ajax request on every keypress. So if my user typed d-o-n-k-e-y, it would send one request for each letter. However, since they take different paths to the server on the network, if they type d-o-n-k-e-y too fast, they don’t always arrive in order. They might arrive as D-n-o-k-y-e, and react accordingly. Is there a good way to make sure all the requests get sent in order?
I don’t think waiting for confirmation from a request before sending the next one would work, because it would slow the information transfer so much. Does anyone have any ideas?
Thanks.
From: http://api.jquery.com/jQuery.ajax/
async boolean
Default: true
Also, it may not be the best idea to send an ajax request every single keystroke. Can’t you use a timeout and send a
donandkeyrequest (buffered up to every 300 ms for example)?