Skip to content

Instantly share code, notes, and snippets.

@TravelingTechGuy
Last active December 14, 2015 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TravelingTechGuy/5069333 to your computer and use it in GitHub Desktop.
Save TravelingTechGuy/5069333 to your computer and use it in GitHub Desktop.
create ad-hoc form and submit it - using jQuery
var postForm = function(destination, fields) {
var form = $("<form/>",{"action":destination,"method":"post"});
$.each(fields, function(name, value) {
form.append($("<input/>", {"type":"hidden", "name":name, "value":value}));
});
//for this to work in FF, form must be appended to body - not necessary in WebKit
$("body").append(form);
form.submit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment