Skip to content

Instantly share code, notes, and snippets.

@markembling
Created January 7, 2011 13:43
Show Gist options
  • Save markembling/769462 to your computer and use it in GitHub Desktop.
Save markembling/769462 to your computer and use it in GitHub Desktop.
Dynamically create and submit a form.
// This would (does) work in proper browsers.
jQuery(createElement('form'))
.attr({'method':'post','action':/*some url*/})
.submit();
// IE needs it to be attached to the document somewhere first before submission will work. :(
var f = jQuery(createElement('form'))
.attr({'method':'post','action':/*some url*/});
jQuery('body').append(f);
f.submit();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment