Ajax Data problem on continous call
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   geetha_sasivarnan
Posted On:   Tuesday, January 17, 2006 11:31 AM

I have a javascript textfield where for every keyup I am sending the data through XMLHttpRequest.
When I type say 1 , it retrieve the value through XMLHttpRequest and displays the value

But if I type continous say 12345 without stopping...for every keyup it is sending the request...so now comes the problem...because of the asynchronous call , it sometimes retrieves the value of 12354 instead of 12345...is there any way to control this?

And is there any way to control the request until the user finishup the typing..I know this sounds stupid as i have coded for keyup request goes for every keyup but still someone could help me on this issue..?

Re: Ajax Data problem on continous call

Posted By:   Christopher_Koenigsberg  
Posted On:   Saturday, January 21, 2006 04:53 PM

Sounds like Ajax lets us get back to those awful painful messy problems, like this, that GUI programmers used to have to waste so much time on, before web applications came along and simplified everything :-)



I'd suppose you'd want to put keys in a buffer and start a timer. If more keys come in before the timer expires, you add them to the buffer and reset the timer. If the timer expires (OR if the buffer gets full), only then do you send the data.



I have no idea how to do this in javascript, and I'm sure it's horribly ugly and messy and impossible to test and debug. And I don't know if any of the available Ajax libraries have tools to help with this....... (a big reason why I've sort of ignored Ajax so far :-)
About | Sitemap | Contact