Created
November 8, 2016 11:41
-
-
Save LouisaKB/b8b6ef393bbe55d7798f267a1f2e5b59 to your computer and use it in GitHub Desktop.
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 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