This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// 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: | |
$(function(){ | |
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