Skip to content

Instantly share code, notes, and snippets.

@JoaquinGA
Created April 18, 2017 15:49
Show Gist options
  • Save JoaquinGA/60fba74a0401a2c884266cdb2f19decd to your computer and use it in GitHub Desktop.
Save JoaquinGA/60fba74a0401a2c884266cdb2f19decd to your computer and use it in GitHub Desktop.
Redireccionar página enviando parámetros post
function relocate(page,params){
var body = document.body;
form=document.createElement('form');
form.method = 'POST';
form.action = page;
form.name = 'jsform';
for (index in params){
var input = document.createElement('input');
input.type='hidden';
input.name=index;
input.id=index;
input.value=params[index];
form.appendChild(input);
}
body.appendChild(form);
form.submit();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment