1.1.1 • Published 10 years ago

ajax-promise-in-browser v1.1.1

Weekly downloads
38
License
-
Repository
github
Last release
10 years ago

#Description

A ajax base promise, browser supports promise.

browse don't supports promise use https://www.npmjs.com/package/ajax-promise-simple

一个浏览器支持promise的ajax

浏览器不支持promise的请使用https://www.npmjs.com/package/ajax-promise-simple

#Usage 用法

var ajaxPromise = require('ajax-promise-simple')

/**
    有四个属性方法:
    ajaxPromise.get => return text
    ajaxPromise.getJSON  => return JSON
    ajaxPromise.post => return text
    ajaxPromise.postJSON  => return JSON
*/

ajaxPromise[get|getJSON|post|postJSON](url, params)
.then(function(data){
})
.catch(function(error){
})

###ES5

var ajax = require('ajax-promise-in-browser')

ajax.get('http://***/login', 
    {username:aaa, password:123456})
.then(function(data){
})
.catch(function(error){

})

###ES6

ajax.post('http://***/login', 
    {username:aaa, password:123456})
.then((data) => {
})
.catch((error) => {

})
1.1.1

10 years ago

1.1.0

10 years ago

1.0.8

10 years ago

1.0.6

10 years ago

1.0.5

10 years ago

1.0.4

10 years ago

1.0.3

10 years ago

1.0.2

10 years ago

1.0.1

10 years ago

1.0.0

10 years ago

0.0.1

10 years ago