Skip to content

Instantly share code, notes, and snippets.

Created March 13, 2012 19:07
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
// Boilerplate code to make the above work
var readyDef = new $.Deferred();
var readyP = readyDef.promise();
$(function(){ readyDef.resolve() });
$.when($.get('rss.xml'), readyP).then(function(rss){
// second argument purposefully ignored since I only care about synchronization
// build a document fragment
// append to the document
// Some students did:
var rssP = $.get('rss.xml') rssP.then(function(rss){
// build fragment
// append to DOM
/* Works as well, but the request isn't done until the document is
** ready which may be as late as the load event in old browsers
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment