3.5.0 • Published 8 years ago

ajax-promise-es6 v3.5.0

Weekly downloads
4
License
ISC
Repository
github
Last release
8 years ago

ajax-promise-es6

Promise based Ajax module for react/react-native apps.

##Installation: npm i -S ajax-promise-es6

Usage:

// default timeout is 3000ms
// url    : {type: 'string'}
// body   : {type: 'object'}
// headers: {type: 'object', optional: 'true'}

import Ajax from 'ajax-promise-es6'

Ajax.post(url, body, headers).then((res)=> {  
            console.log(res);  
  }).catch((err)=> {
      console.log(err);
  });

Ajax.get(url, body, headers).then((res)=> {  
            console.log(res);  
  }).catch((err)=> {
      console.log(err);
  });

##Example:

Ajax.post(url,
             {
                foo: 'hello',   // body data
                bar: 'there'
              },
              {
                'Cookie': 'foo=bar'  // headers
              }
    ).then((res)=> {
            // use JSON.parse(res);  
            console.log(res);  
  }).catch((err)=>{
      console.log(err);
  });
3.5.0

8 years ago

3.1.2

8 years ago

3.1.0

8 years ago

2.1.2

8 years ago

1.2.2

8 years ago

1.1.3

8 years ago

1.1.2

8 years ago