o-ajax

0.0.10 • Public • Published

o-ajax

ajax for node.js

Install

npm install o-ajax

DEMO

normal

var ajax = require('o-ajax');
+async function(){
  var o = await ajax.get("https://www.bimwook.com/woo/about.do");
  if(!o.error){
    console.log(o.data.toString());
  }
  else {
    console.log(o.error);
  }
}();

POST:

var ajax = require('o-ajax');
+async function(){
  var body = [];
  body.push("u=bamboo");
  body.push("p=******");
  var o = await ajax.post("https://www.bimwook.com/woo/ajax.do", body.join("&"));
  if(!o.error){
    console.log(o.data.toString());
  }
  else {
    console.log(o.error);
  }
}();

The return object:

{
  data:[Buffer]
  error: [error]
  code: [int]
  headers: [object]
}

That's All.

Readme

Keywords

Package Sidebar

Install

npm i o-ajax

Weekly Downloads

1

Version

0.0.10

License

MIT

Last publish

Collaborators

  • xolor