Last active
March 27, 2022 16:24
-
-
Save CodyKochmann/5a63369fe8a21998b38c to your computer and use it in GitHub Desktop.
grep (actually curl) equivalent (http requester) for javascript
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
curl = (theUrl) -> | |
xmlHttp = null | |
xmlHttp = new XMLHttpRequest | |
xmlHttp.open 'GET', theUrl, false | |
xmlHttp.send null | |
xmlHttp.responseText | |
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 curl(theUrl){ /* reference link:http://stackoverflow.com/questions/247483/http-get-request-in-javascript*/ | |
var xmlHttp = null; | |
xmlHttp = new XMLHttpRequest(); | |
xmlHttp.open( "GET", theUrl, false ); | |
xmlHttp.send( null ); | |
return xmlHttp.responseText; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment