3.0.6 • Published 8 years ago

marmottajax v3.0.6

Weekly downloads
38
License
WTFPL
Repository
github
Last release
8 years ago

marmottajax

Simple ajax library

Logo

Usage

The different methods that can be used with this library are: get,post, put, delete.

Simply get file content

marmottajax("text-file.txt").success(function(content) {
    // content
});

Post data

marmottajax({
    url: "post.php",
    method: "post",
    parameters: {
        image: 8,
        by: "click"
    }
}).success(function(result) {
    // result
}).error(function(message) {
    // message
});

Receive Json

marmottajax({
    url: "data.json",
    json: true
}).success(function(result) {
    // result
});

Watch changes on file

var watcher = new marmottajax({
    url: "data.json",
    json: true,
    watch: 200 // watch interval in ms
}).success(function(result) {
    // initial request
}).change(function(result) {
    // called when different response detected
});

// Change interval time of watcher
watcher.setTime(1000);

Custom headers and form data

marmottajax({
    url: "path",
    method: "post",
    formData: formData
    headers : {
        "Authorization": "Bearer baf9f0171b11d10f600bfb0cd98b"
    }
}).success(function(result) {
    // result
});

Contributing

marmottajax minifying npm script :

  • install modules : npm i
  • launch npm run build

License

WTFPL

3.0.6

8 years ago

3.0.5

8 years ago

3.0.4

8 years ago

3.0.3

8 years ago

3.0.2

9 years ago

3.0.1

9 years ago

3.0.0

9 years ago

2.2.0

9 years ago

2.0.2

10 years ago

2.0.1

10 years ago

2.0.0

10 years ago