Since you are working within the onFormSubmit try using the $form instead of your jquery object.
firstName = jQuery('input[name=firstname]').val();
firstName = $form.find('input[name=firstname]').val();
I believe the issue is that by just using the "jQuery" object you are working within the object, and not within the form's iframe. Switching to use the $form object should place you in the correct scope.
Or if you wish to avoid using jQuery entirely you can use: