API Reference
Common Attribute Reference
The following are core attributes that you will reach for commonly.
| Attribute | Description |
|---|---|
| data-request | makes a request to a given AJAX handler |
| data-request-data | supplies postback data with the request |
| data-request-query | supplies query data with the request and modifies the URL |
| data-request-trigger | the event that triggers the request |
| data-request-poll | automatically triggers the request at a regular interval |
| data-request-update | request specified partial view updates |
Additional Attribute Reference
All other attributes are specified below.
| Attribute | Description |
|---|---|
| data-request-confirm | displays a confirmation message before sending the request. |
| data-request-before-send | execute JavaScript before the request is sent. |
| data-request-before-update | execute JavaScript before the page contents are updated. |
| data-request-success | execute JavaScript on a successful request. |
| data-request-error | execute JavaScript on a failed request. |
| data-request-complete | execute JavaScript on every completed request. |
| data-request-cancel | execute JavaScript if the user aborts the request or cancels it via a confirmation dialog. |
| data-request-redirect | specifies a URL to redirect the browser after the successful AJAX request. |
| data-request-message | displays a progress message with the specified text, shown while the request is running. |
| data-request-download | when specified file downloads are accepted with a Content-Disposition response. |
| data-request-files | when specified the request will accept file uploads using the FormData interface. |
Available Events
| Event | Target | Description |
|---|---|---|
| ajax:before-send | window | fired before sending a request. |
| ajax:before-update | trigger | fired after the request is complete, but before the page is updated. |
| ajax:update | element | fired after the element has updated. |
| ajax:update-complete | window | fired after all elements have updated. |
| ajax:request-success | window | request has completed successfully. |
| ajax:request-error | window | request encountered an errors. |
| ajax:error-message | window | an error message wants to display. |
| ajax:confirm-message | window | a confirm message wants to display. |
| ajax:setup | trigger | before a request is formed. |
| ajax:promise | trigger | before the request is sent. |
| ajax:done | trigger | the request was successful. |
| ajax:fail | trigger | the request failed. |
| ajax:always | trigger | the request failed or was successful. |
Available Response Methods
| Method | Description |
|---|---|
| update() | adds DOM updates to the AJAX response |
| data() | adds response data to the response |
| redirect() | adds a browser redirect to the response |
| reload() | adds a browser refresh command to the response |
| flash() | adds flash messages to the response |
| error() | adds an error message to the response |
| fatal() | adds a fatal error message to the response |
| js() | adds a JavaScript file or files to load with the output |
| css() | adds a StyleSheet file or files to load with the output |
| img() | adds an image file or files to load with the output |
| browserEvent() | adds browser event dispatch with the response |
| browserEventAsync() | adds asynchronous browser event dispatch with the response |
| invalidFields() | adds invalid form fields to the response |
| partials() | provides multiple requested partial responses to the browser |
| exception() | processes an exception as an response |
Available Override Methods
| Method | Description |
|---|---|
| registerCustomResponse() | replaces the AjaxResponse class with a custom one |
| registerGlobalComponent() | register a stateless component class available globally |
JavaScript API Reference
| Method | Description |
|---|---|
| jax.ajax() | issues an AJAX request |
| jax.request() | issues an AJAX request with a form element |
| jax.flashMsg() | displays a flash message |
| jax.progressBar() | displays the progress bar |
| jax.attachLoader() | flags an element as loading |
| jax.pageReady() | waits for the page to be ready |
| jax.waitFor() | waits for a an object to exist |
| jax.dispatch() | triggers a global event |
| jax.trigger() | triggers an event on an element |
| jax.on() | triggers an event on an element |
| jax.off() | triggers an event on an element |
| jax.values() | extract the input values from a container element. |
Turbo Router Functions
| Method | Description |
|---|---|
| jax.useTurbo() | returns true if turbo routing is enabled |
| jax.visit() | updates the page location |
Hot Control Functions
| Method | Description |
|---|---|
| jax.registerControl() | registers a new hot control |
| jax.importControl() | returns a registered hot control class definition |
| jax.observeControl() | attach a hot control and return the instance |
| jax.fetchControl() | fetch an instance on a single element |
| jax.fetchControls() | fetch instances on a multiple elements |