Question moved to Feedback, Please ignore (Timing of functions using function.done() looking for best practices)

hi everyone! Please take a look at this pen http://codepen.io/bencarp/pen/qRbKeM/
when I run it I get an error in the console “error: cannot read property ‘done’ of undefined.” I guess the function should return a value which is a promise. But how do I do that?