I work on a website where the interface is powered by AJAX, interacting with the server in the usual RESTful manner and receiving responses as JSON.
This is simple enough to manage POST, DELETE, and PUT requests, as they will not differ from the traditional approach. The challenge is to get the content. Sometimes a client needs to GET one resource from the server. Sometimes more.
Is there a performance issue with asynchronously disabling each individual GET request and populating the DOM elements as responses arrive?
I think so (but correct me if I am mistaken), and that an increase in performance is possible by, say, providing an array of API requests in a single request and for a server response with a corresponding array of JSON responses.
POST, DELETE, and PUT are semantically incorrect for this kind of task. Also, the GET request seems wrong. After sending a GET request, /ajax_handler?q=get_users,get_pages,get_current_userit seems strange, since I'm used to seeing a GET request as a separate resource.
Another alternative is to prepare all the relevant data for each GET request (for example, on a regular page other than AJAX), and put it all together, leaving a clarification of what is important / newer for the client, possibly through the last modified an element in each JSON array.
- , , GET, , ,