Skip to content

Instantly share code, notes, and snippets.

@CodyKochmann
Last active March 27, 2022 16:24
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save CodyKochmann/5a63369fe8a21998b38c to your computer and use it in GitHub Desktop.
Save CodyKochmann/5a63369fe8a21998b38c to your computer and use it in GitHub Desktop.
grep (actually curl) equivalent (http requester) for javascript
curl = (theUrl) ->
xmlHttp = null
xmlHttp = new XMLHttpRequest
xmlHttp.open 'GET', theUrl, false
xmlHttp.send null
xmlHttp.responseText
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