ajax in python Requests style
author Meng G. gaomeng1900@gmail.com
date 2016-03-19
github https://github.com/gaomeng1900/requests.git
ref XHR 2 ducoment: https://xhr.spec.whatwg.org/
A pack of useful ajax methods, including:
GET
POST (form/file)
PUT (form/file)
DELETE
single file upload
Support ADM/commonJS/global
####excam:
new Requests({
url: 'http://server.com:9040?uid=admin&token=qwer#jiajiajia',
params: {
name: 'wahaha',
file:ele.files[0]
},
load:function(args){
console.warn('MY LOAD HANDLER: ', args)
},
progress:function(args){
console.warn('MY progress HANDLER: ', args)
}
}).post()
or:
new Requests('http://server.com:9040?uid=admin&token=qwer#jiajiajia').post()
.load(function(args) { console.log(args) })
.error(function(args) { console.error(args) });
Read more in src/requests.coffee
Excample in dist/index.html