1.1.2 • Published 9 years ago

ainojs-ajax v1.1.2

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

Ajax

Minimal ajax library for JSON requests that returns a Promise.

Installation:

Using npm:

npm install ainojs-ajax

In the browser:

Usage example:

Ajax.get('/').then(function(response) {
  console.log(response)
})

Ajax.post('/', { foo: 'bar' }).then(function(response) {
  console.log(response)
})

Ajax.jsonp('http://en.wikiquote.org/w/api.php', {
  action: 'opensearch',
  search: 'kill'
}).then(function(response) {
  console.log(response)
})

Methods:

// performs an ajax GET request to [url] and returns a promise
Ajax.get(url)

// performs an ajax POST request to [url] and returns a promise
Ajax.post(url, [data])

// performs a JSONP request to [url] and returns a promise. 
// callbackname defaults to "callback" and timeout to 15000ms 
Ajax.jsonp(url, [data], [callbackname], [timeout]) 
1.1.2

9 years ago

1.1.1

9 years ago

1.1.0

9 years ago

1.0.5

9 years ago

1.0.4

9 years ago

1.0.3

9 years ago

1.0.2

9 years ago

1.0.1

9 years ago