Skip to content

Instantly share code, notes, and snippets.

@twesolowski
Created May 28, 2018 11:13
Show Gist options
  • Save twesolowski/97bfae4364784653963e5ae4ad2c2eac to your computer and use it in GitHub Desktop.
Save twesolowski/97bfae4364784653963e5ae4ad2c2eac to your computer and use it in GitHub Desktop.
util
var util = {};
util.post = function(url, target, fields) {
var $form = $('<form>', {
action: url,
target : target,
method: 'post'
});
$.each(fields, function(key, val) {
$('<input>').attr({
type: "hidden",
name: key,
value: val
}).appendTo($form);
});
$form.appendTo('body').submit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment