request-cors

Request is an Ajax Wrapper with cross browsing support


Keywords
request, ajax, wrapper, cors, cross, domain
License
MIT
Install
bower install request-cors

Documentation

request

GET

request.get(url, query);
request.get(url, {
    key: 'value'
})
.success(function(response, xhr){
    console.log(response);
})
.error(function(message, xhr){
    console.log(message);
})
.always(function(){
    console.log('always');
});

POST

request.post(url, data, query);
request.post(url, {
    key: 'value'
}, {
    key: 'value'
})
.success(function(response, xhr){
    console.log(response);
})
.error(function(message, xhr){
    console.log(message);
})
.always(function(){
    console.log('always');
});

PUT

request.put(url, data, query);
request.put(url, {
    key: 'value'
}, {
    key: 'value'
})
.success(function(response, xhr){
    console.log(response);
})
.error(function(message, xhr){
    console.log(message);
})
.always(function(){
    console.log('always');
});

DELETE

request.delete(url, query);
request.delete(url, {
    key: 'value'
})
.success(function(response, xhr){
    console.log(response);
})
.error(function(message, xhr){
    console.log(message);
})
.always(function(){
    console.log('always');
});