tags:

views:

71

answers:

1

How can I submit jQuery form object (not ajax)?

I try form.submit() and it doesn't work.

I create the form by

tempform = $("<form method='post'></form>");
tempform.attr("action", "abc.aspx");

and then append some form elements into it.

tempform.submit();
+1  A: 

Maybe try this:

tempform = $("<form method='post'></form>").attr('id','myForm');
tempform.attr("action", "abc.aspx");
$('body').append(tempform);
$('#myForm').submit();

Also worth pointing out that it has no elements. What makes you say it doesn't work?

karim79
Thanks. I forget to append the form to body.
Billy