Skip to content

Instantly share code, notes, and snippets.

@LouisaKB
Created November 8, 2016 11:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save LouisaKB/b8b6ef393bbe55d7798f267a1f2e5b59 to your computer and use it in GitHub Desktop.
Save LouisaKB/b8b6ef393bbe55d7798f267a1f2e5b59 to your computer and use it in GitHub Desktop.
function postRequest(request, endpoint, callback) {
var xhttp = new XMLHttpRequest();
xhttp.onreadystatechange = function () {
if (xhttp.readyState == 4 && xhttp.status == 200) {
callback(xhttp.responseText);
}
};
xhttp.open("POST", "https://api.traveltimeapp.com/v3/" + endpoint, true);
xhttp.send(request);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment