Note that there are some explanatory texts on larger screens.

plurals
  1. POIsn't AJAX on pageload a bad thing?
    text
    copied!<p>I've seen this on <a href="http://nerddinner.codeplex.com" rel="nofollow noreferrer">nerd dinner</a> and other sites. On page load (in JavaScript, via the browser), an AJAX request will go out to get some data from the same server that rendered the initial page. The data will be small and there are no technical limitations that would have otherwise prevented them from just pulling down that data in the first place.</p> <p>Isn't this a bad thing? It seems like a waste of an AJAX call, since they could just render this data as JavaScript with the rest of the page. </p> <p>My bank uses AJAX to pull the information to build form elements for a "Transfer Funds" form. That information is a few kilobytes, an AJAX request there seems overkill.</p> <p>In nerd dinner, at least in the <a href="http://videos.visitmix.com/MIX09/T49F" rel="nofollow noreferrer">MIX09 video</a> that I saw, they are querying (via AJAX) a set of dinners to render on the map control on page load.</p> <p>I could understand if we're talking large amounts of data that would otherwise take too long to pull down, but if its under 10-15kb, wouldn't it just be better to pull the data down with the markup? Are they doing this to avoid caching of the data?</p> <p>Edit: What I'm proposing is that instead of opening up an AJAX call to the server to pull down json data on the clients onload, simply have asp.net (or whatever) render the json in the pages content when it renders everything else. I just felt the need to point that out because the actual client side code would be exactly the same, except for where the json variable originates.</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