w3c-xmlhttprequest

Server-side XMLHttpRequest.

npm install w3c-xmlhttprequest
16 downloads in the last day
26 downloads in the last week
84 downloads in the last month

node-xmlhttprequest

Server-side XMLHttpRequest like W3C spec for Node.

This library is still in development. We are recruiting contributors and your pull requests.

Install

$ npm install w3c-xmlhttprequest

or

$ npm install git://github.com/ykzts/node-xmlhttprequest.git

Example

Simple GET request

var XMLHttpRequest = require('w3c-xmlhttprequest').XMLHttpRequest;

var client = new XMLHttpRequest();
client.open('GET', 'http://example.com/');
client.addEventListener('load', function(event) {
  console.log('HTTP Request OSHIMAI.');
}, false);
client.send();

Parse JSON response

var XMLHttpRequest = require('w3c-xmlhttprequest').XMLHttpRequest;

var client = new XMLHttpRequest();
client.open('GET', 'http://exmaple.com/data.json');
client.responseType = 'json';
client.addEventListener('load', function() {
  var data = client.response;
  if (data.meta.status !== 200) {
    return;
  }
  console.log(data.response.blog.title);
}, false);
client.send();

LICENSE

MIT License

npm loves you