How can I redirect with post data?
How to move to new page with $_POST?
How to do this? How is it done and whyfore shall it be done
"extended" the above solution with target. For some reason i needed the possibility to redirect the post to _blank or another frame:
$.extend(
{
redirectPost: function(location, args, target = "_self")
{
var form = $('');
form.attr("method", "post");
form.attr("action", location);
form.attr("target", target);
$.each( args, function( key, value ) {
var field = $('');
field.attr("type", "hidden");
field.attr("name", key);
field.attr("value", value);
form.append(field);
});
$(form).appendTo('body').submit();
}
});