Answer the question
In order to leave comments, you need to log in
How to pass data with NodeJS AJAX to the site, after request from the site?
How to transfer data from the node with ajax to the site, at the request of the site. Get request is used. On the client, pure JS (not JQ) and a node without express and other frameworks.
Answer the question
In order to leave comments, you need to log in
It's hard to understand your text.
Do you want to send a request from your code to an external site? Then, here is - https://www.npmjs.com/package/request
Decision:
var http = require('http');
var port = 8081;
var s = http.createServer();
s.on('request', function(request, response) {
response.writeHead(200);
console.log(request.method);
console.log(request.headers);
console.log(request.url);
var data = '';
request.on('data', function(chunk) {
data += chunk.toString();
});
request.on('end', function() {
console.log(data);
response.write('hi');
response.end();
});
});
s.listen(port);
console.log('Browse to http://127.0.0.1:' + port);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question