Skip to content

am05mhz/jsessentials

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 

Repository files navigation

errand

small javascript library

Usage

AJAX

Get json

x_x.errand({
    url: 'json-url',
    json: true
}).success(function(result) {
    console.log(result);
});

Post data

x_x.errand({
    url: 'post-url',
    method: 'post',
    data: {
        somedata: 'somevalue'
    }
}).success(function(result) {
    console.log(result);
}).error(function(message) {
    console.log(message);
});

Custom headers

somedata = {postdata: 'postvalue'}
x_x.errand({
    url: 'post-url',
    method: 'post',
    data: somedata,
    headers : {
        someheader: 'some header value'
    }
}).success(function(result) {
    console.log(result);
});

Abort/cancel request

var req = x_x.errand('http://abc.com');
req.cancel()

Extend object

x_x.extends({}, {someProperty: 'someValue'});

Type checks

someVar = {};
x_x.isVarTypeOf(someVar, Object); //true
x_x.isVarTypeOf(someVar, Array); //false

Attach events

x_x(window).on('ready', function(){ console.log('doc ready') });

About

small javascript library

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published