using jquery AJAX with node.js, handling the response from the server using jquery AJAX with node.js, handling the response from the server express express

using jquery AJAX with node.js, handling the response from the server


Try the following code server side:

app.get('/search', function(req, res){    factual.get('/t/places',{q:'starbucks'}, function (error, data) {      console.log(data);      res.writeHead(200, { 'Content-Type': 'application/json' });       res.end(JSON.stringify(data));    });});

It should work. The code client side looks ok.

Edit: You can use also :

res.json(data);