Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>One possible approach is to have a batching action, which your script will call. This action will internally call all partial views, when wrap their results in a JSON object. On the client side, your script will unwrap the partial views results and will put them at the proper places in the page.</p> <p>However, there are several limitations of such an approach (and of what you want to do in general):</p> <ul> <li>it will render the browser cache useless. Since you don't know which of the partial views might have changed, the batching action response should be non-cacheable. On the other hand, if you were to make several calls to each partial view, each of them can control it's caching which can potentially result in substantial bandwidth savings.</li> <li>you are artificially slowing the client. Your network request will take the amount of time to process all partial views rendering on the server side on one thread (unless you try to spin out multiple threads and make the calls in parallel.). On the other hand, if you make multiple calls for each partial view, the browser can make several of them at the same time, which will parallelize the task for you. And since each part of the page will be updated as it's returned, the overall user experience might actually be better.</li> <li>you are hurting load-balancing. If you are load-balancing multiple servers, multiple requests might end up on separate servers, thus creating better response time.</li> </ul> <p>Frankly, if you are going to update multiple parts of the page, but you want to batch that operation, you might as well stop using Ajax and just reload the full page instead.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload