After creating a web application with a dashboard to showcase different reports and graphs based on user selections, I encountered an issue.
Users can interact with the reports using checkboxes and radio buttons. Every time a checkbox or radio button is selected, an ajax call is made to display the corresponding report.
The problem arises when users rapidly click on multiple checkboxes or radio buttons in quick succession. The server receives and responds to these requests in the same order they were sent, causing reports to overwrite each other almost instantly.
For instance, if there are two radio buttons - one for a pie chart and another for a line graph - and a user clicks on both rapidly, the pie chart will be displayed first but quickly replaced by the line graph.
Is there a way to prioritize the latest request over all earlier ones?
Important Points:
- I aim to avoid continuous server hits while complying with the client's wish of not having a submit button.
- It would be ideal to implement a javascript/ajax solution that only sends the most recent request to the server.
- My technology stack includes Java/J2EE Struts2 framework, along with javascript and ajax.