I have a website in which changes are very constant on the user side. So to prevent from submitting an ajax request for each user every 3-6 seconds, I want to wait for the user to finish the actions and then submit all to the server.
So, instead of submitting many very small ajax requests, I want to hold it and submit all at once, when the user is inactive (not changing anything) for 1 minute or so. (a bit like an autosave function)
The problem is, since the user can update different parts of the application I need to update different rows in one call, so how would I do this?
Since the POST variable needs an identifier, my first idea is to submit one array of id's and another array of data. Then on the backend rebuild the arrays, iterate, and saving data accordingly. But something tells me it's not the optimal approach, could you guys give me some tips on how to go about this?