1.1.3 • Published 4 years ago

@indlekofer/ajax_json v1.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

@indlekofer/ajax_json

npm version

Usage

import request from '@indlekofer/ajax_json';

let setting = {};
request(settings)
  .then((req) => {
    console.log(req.status);
    //containes the parsed json object
    console.log(req.responseJson);
  }, (req) => {
    //e.g.: timeout or json parser problems
    console.log(req.error);
  })

Parameters

settings: object settings
req: object (default XMLHttpRequest)

Settings

settings objekt

url: string (default: '/')
method: string (default: 'GET')
body: object request body
query: object request get
async: bool (default: true)
withCredentials: bool (default: false) seend cookies
auth: string (default false) base64 encoded authentication string

Errors

compare the req.error with the given error code constants

ERROR_JSON: invalid json response
ERROR_TIMEOUT: the request timed out
ERROR_REJECT: rejected request. e.g.: cors

1.1.3

4 years ago

1.1.2

5 years ago

1.1.1

5 years ago

1.1.0

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago