I am working on a site the uses a number of ajax requests. One of these ajax requests is saving the selection a user makes from a slider. It is a jquery ui slider, but as the question isn't specific to the slider I didn't put it in that forum
Now realistically the user would probably stop and move the slider around a number of times before deciding what they want. This would cause the the ajax event to fire multiple times in a short amount of time. I have a number of other ajax requests on the site where this same problem arises As I'm looking to keep things as efficient as possible, I wan't to find a way to reduce the number of requests to the server.
I'm wondering if there is a way to have jquery/javascript, when an event is fired that would cause a ajax request, it will wait a second or two to see if that same event fired. If that event is fired again within that time frame, it resets the timer. Thus if I have the same event fire multiple times within a few seconds, after the user is done making their selection and that timer has expired, only one ajax request is sent to the server.
Thanks!