Skip to content

Instantly share code, notes, and snippets.

Embed
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:
$(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
You can’t perform that action at this time.