Stack Overflow thread on changing order of execution of JavaScript using Deferred
stackoverflow.com