TrophyCustomer's Canvas is honored with a 2020 InterTech Technology Award! Learn more 

Interface: IAuWidgetAjaxConfig

Provides properties that are used to send requests to the server and receive responses.

You can use these properties in params of the AuWidgetAjax class.

The following example illustrates how you can populate a gallery with images obtained through an HTTP request.

{
  "widgets": [
   {
     "name": "gallery-images",
     "type": "ajax",
     "params": {
       "lock": "gallery",
       "url": "https://example.com/api/images?subfolder=cats",
       "method": "GET",
       "responseType": "json"
     }
   }
 ]
}

Hierarchy

  • IAuWidgetAjaxConfig

Index

Properties

Properties

enabled

enabled: boolean

If false, the request will not be executed. The default value is true.


headers

headers: object

A dictionary of HTTP headers sent along with the request (an object with the keys used as a header name and a value used as a header value).

Type declaration:

  • [ key: string]: string

lock

lock: string[] | string

The widget names that should be locked while waiting for the response. The editor will show a preloader on this widget.


method

method: string

An HTTP method like POST, GET, etc. The default value is POST.


onError

onError: Function | Array‹Function›

A function ("{{#function <expression>}}") or an array of functions that should work when the request fails.


onSuccess

onSuccess: Function | Array‹Function›

A function ("{{#function <expression>}}") or an array of functions that work after the successful request.


request

request: any

The request body. Typically, you put a JSON here that consists of references to other widgets.


requests

requests: Array‹any›


responseType

responseType: ResponseType

Defines how to interpret the response received from the server.


url

url: string

A URL that is used to accept requests.