Last active
August 29, 2015 14:10
-
-
Save ideodora/2b93494c9fe3c083fe35 to your computer and use it in GitHub Desktop.
ajax no jquery browserify
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
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