I have a .NET application that access methods located on handlers through AJAX calls. This AJAX calls are fired, generally, when the user clicks on certain buttons. My problem happens when the user clicks the buttons more than once. It messes up with all my object´s state.
How do u take care of it? I know I can block the user click until the first call finishes, but I would like to find a solution to take care of this matter in the server side. Any idea?
Thanks!
I believe that this is best achieved using client code. If you are using jQuery then one() may be an elegant solution. Alternatively you could set a variable to true when starting a request and set it to false when finished. Then prevent all further requests while the variable is set to true.
Doing it server side won’t work. The server may have finished processing, but the message hasn’t arrived to the client yet. The client then makes a new request. The server reacts to it as it is a new one. Havoc may occur in cases like this.