As you can see, I am using LAB.js to load the remote scripts. The LAB.js script() and wait() functions both return a reference to the chainable object used to load a group of dependent script files. I keep a reference to this chainable object so that I can then invoke the wait() method one more time at the bottom of the page in order to execute the init() script.
Since I am at the bottom of the page already, I don't technically have to use jQuery's DOM-ready event; I could just pass the init function reference to the wait() method as a callback. This would be a bit more straightforward; but, for demonstration purposes, I'm still hooking into the DOM-ready event.
When we run the above code, we get the following console output:
Oh Mr. Mittens! You're so cute!
Since I didn't actually change any of the remote script files, I won't bother showing them here. If you are interested in how they work, please take a look at last week's post.
Want to use code from this post? Check out the license.