You've added a console.log line in codesy.appendForm before creating the deferred object.  Is this where it fails?