Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

AJAX Helper for NodeJS, instead of jQuery?

AJAX Helper for NodeJS, instead of jQuery?


I just want to do something like $.get/post on a server side script. Is there a better way instead of including the whole jQuery? I prefer not to use the messy get xml http requests stuff manually either.

Problem courtesy of: Jiew Meng


The equivalent to jquery.ajax in node.js is request

It sits on top of the node core http and makes things nicer to work with. Allowing for both callback and streaming requests.


var request = require('request');
request('', function (error, response, body) {
  if (!error && response.statusCode == 200) {
    console.log(body) // Print the google web page.

Solution courtesy of: generalhenry


View additional discussion.

This post first appeared on Node.js Recipes, please read the originial post: here

Share the post

AJAX Helper for NodeJS, instead of jQuery?


Subscribe to Node.js Recipes

Get updates delivered right to your inbox!

Thank you for your subscription