Created
December 15, 2014 19:32
-
-
Save jonatasemidio/03b613391b41cd2a2247 to your computer and use it in GitHub Desktop.
POST JS
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 post_to_url(url, params) { | |
var form = document.createElement('form'); | |
form.action = url; | |
form.method = 'POST'; | |
for (var i in params) { | |
if (params.hasOwnProperty(i)) { | |
var input = document.createElement('input'); | |
input.type = 'hidden'; | |
input.name = i; | |
input.value = params[i]; | |
form.appendChild(input); | |
} | |
} | |
form.submit(); | |
} | |
function post_obj(obj){ | |
alert(obj); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment