Last active
August 29, 2015 13:56
-
-
Save madhavan-rp/8858467 to your computer and use it in GitHub Desktop.
Javascript Snippets
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 f1() { | |
xmlhttp = new XMLHttpRequest(); | |
xmlhttp.open("POST","/api/v1/endpoint",true); | |
xmlhttp.setRequestHeader("Content-Type","application/json"); | |
xmlhttp.send(JSON.stringify({"text":"Classify this!"})); | |
console.log("" + xmlhttp.responseText); | |
} | |
function get() { | |
xmlhttp = new XMLHttpRequest(); | |
xmlhttp.onreadystatechange = function() { | |
if (xmlhttp.readyState == 4) { | |
console.log("Got Response"); | |
} | |
} | |
var link = "<URL here>"; | |
xmlhttp.open("GET",link,true); | |
xmlhttp.send(null); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment