
# 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](../classes/auwidgetajax.md) 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

* [enabled](iauwidgetajaxconfig.md#enabled)
* [headers](iauwidgetajaxconfig.md#headers)
* [lock](iauwidgetajaxconfig.md#lock)
* [method](iauwidgetajaxconfig.md#method)
* [onError](iauwidgetajaxconfig.md#onerror)
* [onSuccess](iauwidgetajaxconfig.md#onsuccess)
* [request](iauwidgetajaxconfig.md#request)
* [requests](iauwidgetajaxconfig.md#requests)
* [responseType](iauwidgetajaxconfig.md#responsetype)
* [url](iauwidgetajaxconfig.md#url)

## 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](../README.md#responsetype)*

Defines how to interpret the response received from the server.

___

###  url

• **url**: *string*

A URL that is used to accept requests.
