Deprecated
March 5, 2016 ยท View on GitHub
Usage (used until v0.0.15)
AMD
define([ 'Ajax' ], function( Ajax ) {
var ajax = new Ajax();
...
});
CommonJS
var Ajax = require( '@fdaciuk/ajax' );
var ajax = new Ajax();
...
Method of window object
var ajax = new window.Ajax();
or
var ajax = new Ajax();
Note
Ajax constructor is deprecated and will be removed in v2.0.0. Use ajax() function (lowecase version) without new keyword instead.
Enjoy ;)
Deprecated return methods
done(response, xhrObject)
Promise that returns if the request was successful.
done is deprecated. Use then instead.
ajax().get( '/api/users' ).done(function( response, xhr ) {
// Do something
});
error(response, xhrObject)
Promise that returns if the request has an error.
error is deprecated. Use catch instead.
ajax().post( '/api/users', { slug: 'john' }).error(function( response, xhr ) {
// Do something
});