Skip to content

Instantly share code, notes, and snippets.

@Programmercito
Created February 26, 2018 14:54
Show Gist options
  • Save Programmercito/9b6964efe62a8f396b298785a89c695a to your computer and use it in GitHub Desktop.
Save Programmercito/9b6964efe62a8f396b298785a89c695a to your computer and use it in GitHub Desktop.
Send parameters to URL with out query parameters with JAVASCRIPT
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