/* need JQuery */
/* function to redirect a webpage to another using post method */
function redirect_by_post(purl, pparameters, in_new_tab) {
pparameters = (typeof pparameters == 'undefined') ? {} : pparameters;
in_new_tab = (typeof in_new_tab == 'undefined') ? true : in_new_tab;
var form = document.createElement("form");
$(form).attr("id", "reg-form").attr("name", "reg-form").attr("action", purl).attr("method", "post").attr("enctype", "multipart/form-data");
if (in_new_tab) {
$(form).attr("target", "_blank");
}
$.each(pparameters, function(key) {
$(form).append('<input type="text" name="' + key + '" value="' + this + '" />');
});
document.body.appendChild(form);
form.submit();
document.body.removeChild(form);
return false;
}
$('#btn').button().click(function() {
redirect_by_post('http://pamppi.info/jotform-testing/thankyou/postvars.php', {
variable1: 'Carlos',
variable2: 'Garcia'
}, true);
});
<div class='ui-state-highlight ui-corner-all'>
in the server there is only a <br/> <br/> < ? php print_r($_POST) ? >
<br/> <br/>
So you can send any variables
</div>
<button id="btn">go an check the variables sent by post</button>
.ui-state-highlight {width:200px;margin:20px; padding:20px;}
External resources loaded into this fiddle: