Created
February 26, 2018 14:54
-
-
Save Programmercito/9b6964efe62a8f396b298785a89c695a to your computer and use it in GitHub Desktop.
Send parameters to URL with out query parameters with JAVASCRIPT
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 redirectPost(url, data) { | |
var form = document.createElement('form'); | |
document.body.appendChild(form); | |
form.method = 'POST'; | |
form.action = url; | |
for (var name in data) { | |
var input = document.createElement('input'); | |
input.type = 'hidden'; | |
input.name = name; | |
input.value = data[name]; | |
form.appendChild(input); | |
} | |
form.submit(); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment