Skip to content

Instantly share code, notes, and snippets.

@ideodora
Last active August 29, 2015 14:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ideodora/2b93494c9fe3c083fe35 to your computer and use it in GitHub Desktop.
Save ideodora/2b93494c9fe3c083fe35 to your computer and use it in GitHub Desktop.
ajax no jquery browserify
var fetch = http.request({
host: "stackoverflow.com",
port: 80,
path: "/",
method: "GET",
withCredentials: false // this is the important part
}, function(res) {
var result = ""
res.on('data', function(chunk) {
result += chunk;
});
res.on('end', function() {
console.log("response.................");
console.log(result);
});
});
fetch.setHeader('Ping', 'Pong')
fetch.end()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment