Created
April 18, 2017 15:49
-
-
Save JoaquinGA/60fba74a0401a2c884266cdb2f19decd to your computer and use it in GitHub Desktop.
Redireccionar página enviando parámetros post
This file contains 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
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