Commit eefc8ab6 authored by Craig Norris's avatar Craig Norris

Minor ajax style edits

Minor edits for style to Ajax page.
parent 5eddaaae
...@@ -6,18 +6,20 @@ info: To determine the technical writer assigned to the Stage/Group associated w ...@@ -6,18 +6,20 @@ info: To determine the technical writer assigned to the Stage/Group associated w
# Ajax plugin # Ajax plugin
`Ajax` is a DropLab plugin that allows for retrieving and rendering list data from a server. `Ajax` is a DropLab plugin that allows for retrieving and rendering list data
from a server.
## Usage ## Usage
Add the `Ajax` object to the plugins array of a `DropLab.prototype.init` or `DropLab.prototype.addHook` call. Add the `Ajax` object to the plugins array of a `DropLab.prototype.init` or
`DropLab.prototype.addHook` call.
`Ajax` requires 2 configuration values, the `endpoint` and `method`. `Ajax` requires 2 configuration values: the `endpoint` and `method`.
- `endpoint` should be a URL to the request endpoint. - `endpoint`: Should be a URL to the request endpoint.
- `method` should be `setData` or `addData`. - `method`: Should be `setData` or `addData`.
- `setData` completely replaces the dropdown with the response data. - `setData`: Completely replaces the dropdown with the response data.
- `addData` appends the response data to the current dropdown list. - `addData`: Appends the response data to the current dropdown list.
```html ```html
<a href="#" id="trigger" data-dropdown-trigger="#list">Toggle</a> <a href="#" id="trigger" data-dropdown-trigger="#list">Toggle</a>
...@@ -38,7 +40,7 @@ droplab.addHook(trigger, list, [Ajax], { ...@@ -38,7 +40,7 @@ droplab.addHook(trigger, list, [Ajax], {
}); });
``` ```
Optionally you can set `loadingTemplate` to a HTML string. This HTML string will Optionally, you can set `loadingTemplate` to a HTML string. This HTML string
replace the dropdown list while the request is pending. replaces the dropdown list while the request is pending.
Additionally, you can set `onError` to a function to catch any XHR errors. Additionally, you can set `onError` to a function to catch any XHR errors.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment