var form = $(this).parent();
Ah, good ol' binding of
this at work! If you only provide the method, it will not be called on the form but on the global object, like
submit.call(window) // resp. undefined in strict mode. Hence the error, I guess.
where what you want is
One way to fix this: Bind the submit method to the form: