I’m using AJAX for a search form where the user can limit the number of returned results through a search. This is working well, and the user can just press Enter to perform a search. The problem I have is that if I hold in Enter, I can generate a lot of POST requests. From a performance perspective, I’d like to limit this somehow. Any ideas of how this limiation can be achieved? Is it done in the view file or the controller file?
Right now, I have this to enable the Enter feature:
That’s one way. But with onkeyup i can just press enter over and over again with the only difference that I let go of the key. Can I have some type of timeout, max 20 searches in 40 seconds or something like that?
it all depends on your code… I guess you have some event handler for the ENETER key… for that case you can set some status variable so to know you are processing the first ENETER… and clear that status when the processing is done…