Last active
December 14, 2015 09:59
-
-
Save TravelingTechGuy/5069333 to your computer and use it in GitHub Desktop.
create ad-hoc form and submit it - using jQuery
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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