DollarJS Ajax Plugin
Extend DollarJS with async request capability
Download & Embed
Add both of the following scripts to your webpage (in this order)
Install & Require
Available as a standalone NPM package
$ npm install dollar-js-ajax --save
var $ajax = ;
$.get(url [, data] [, success] [, dataType])
$;
A convenience alias for
$;
$.post(url [, data] [, success] [, dataType])
$;
A convenience alias for
$;
$.getJSON(url [, data] [, success])
$;
A convenience alias for
$;
$.getScript(url [, success] [, error])
$;
$.ajax(settings)
$;
Request Settings
method {String}
An HTTP request method such as 'get', 'post', 'put', 'delete'. Default is 'get'.
headers {Object}
Additional key/value pairs to send on the header of the request.
url {String}
The url to be requested.
data {Object}
Data to be sent to the server. This will be serialized into the query string (search params) on the url of a GET request or sent in the body of a POST request.
cache {Boolean}
A value indicating if the request should be cached. Disabling caching is done by appending _={timestamp}
to the url. Default is true.
Response settings
success {Function}
A callback to be executed after a successful response is received. Callback is passed the parsed response data and the original response object.
error {Function}
A callback to be executed after a request fails for any reason. Callback is passed an error object indicating the reason for the failure.
complete {Function}
A callback to be executed after a request finishes regardless of the outcome. Callback is passed an indication of the status of the response and the original response object.
dataType {String}
The type of data that you're expecting back from the server. Can be 'text', 'html', 'xml', 'json'. If none is specified the Content-Type
response header will be used to determine how to parse the response data. Default is to process as plain text.