Skip to content

Instantly share code, notes, and snippets.

@yuval-a
Created May 2, 2015 01:20
Show Gist options
  • Save yuval-a/84f59d16439d9599185c to your computer and use it in GitHub Desktop.
Save yuval-a/84f59d16439d9599185c to your computer and use it in GitHub Desktop.
XMLHttpRequest POST
var xmlhttp = new XMLHttpRequest();
xmlhttp.open("POST", url, true);
xmlhttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlhttp.onreadystatechange = function() {
if(xmlhttp.readyState == 4 && xmlhttp.status == 200) {
alert(xmlhttp.responseText);
}
}
xmlhttp.send("param=bla&param=bla");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment