Please note: this is not exactly same as this question. Although it looks like that, I have some very specific requirements.
In my application, I have two panels to update with a single AJAX request. Currently, I am sending JSON, and constructing two DOMs in JS and appending them in corresponding places.
This is becoming difficult to maintain, and much processing is happening on the client side. So, I am thinking of sending HTML code snippet.
The problem here is that I have two panels, and with a single AJAX request, how should I bring two different HTML snippets for different panels?
Also: -
1) I am sending the AJAX request periodically after each 30 seconds, and also sending a CRC-32 of the data in the JSON. So, if there is no change in the data I don't have to recreate the DOM.
2) Replacing the old HTML, with new HTML suddenly flickers the page.
3) Each panel can have dynamic number of rows, and I have to attach some events from JavaScript side to each row. For this, it is easier if I have data in JSON format. But if I am switching to HTML snippet, how to do this?