0.0.6 • Published 8 years ago

ajax-lib v0.0.6

Weekly downloads
1
License
WTFPL
Repository
-
Last release
8 years ago

JavaScript, Node.js ajax-lib

ajax-lib

About

ajax-lib is simplified ajax functions to call it easily

Features

1. Dependencies on only one package (request.js)

2. Experimental source code(purpose for studying)

3. Currently in progress (incomplete)

install package

npm i -save ajax-lib

Examples

request with method

var ajax = require('ajax-lib')

ajax.get('http://google.com', function(err, response) {
	//do something with response...
})

ajax.post('http://google.com', function(err, response) {
	//do something with response...
})

ajax.put('http://google.com', function(err, response) {
	//do something with response...
})

ajax.del('http://google.com', function(err, response) {
	//do something with response...
})

request without method & options

var ajax = require('ajax-lib')
ajax.request('http://google.com', function(err, response) {
	//do something with response...
})
ajax.request('http://google.com', {data:{}}, function(err, response) {
		//without method => GET default
    //do something with response...
  })

you can also pass the options with method & data

request with data

the order of the arguments must be url, options, callback

var ajax = require('ajax-lib')
ajax.request('http://google.com', {
  method:"POST",
  data: {
  	formData: {
    },
    exampleData: {
    }
  }
},function(err, response) {
	//do something with response...
})

*Notice*

If the option does not contain a method type when you using request method, GET default value will be requested.

0.0.6

8 years ago

0.0.5

9 years ago

0.0.4

9 years ago

0.0.3

9 years ago

0.0.2

9 years ago

0.0.1

9 years ago