fast, flexible, unit-tested jquery-ajax-stye serverside requests


jQuery ajax is stupid simple.

This project provides a lightweight wrapper for the nodejs http request object that enables jquery ajax style syntax when making serverside requests to other webpages in node.js

It features very flexible method overloads to suit various styles, including with jquery style deferreds.

It seamlessly handles ssl and makes some reasonable assumptions based on inputs but as usual everything can be overridden by passing an options object.

The x is a lie.

Install the module with: npm install najax

var najax = require('najax');
najax('', function(html){ console.log(html); }); // "awesome" 
najax('', { type:'POST' }, function(html){ console.log(html); }); // "awesome" 
najax({ url:'', type:'POST', successfunction(html){ console.log(html); }); // "awesome" 
najax({ url:'', type:'POST' }).success(function(resp){}).error(function(err){}); // "awesome" 
najax.get,, najax.put, najax.delete...
  • cd dir
  • npm -g install grunt
  • npm install
  • grunt test

(Coming soon)

In lieu of a formal styleguide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code using grunt.

Copyright (c) 2012 Alan Clarke
Licensed under the MIT license.