---
title: "au-widget-ajax/IAuWidgetAjaxConfig | Customer's Canvas On-Premises"
canonical: "https://customerscanvas.com/docs/on-premises/ui-framework/widgets/reference/au-widget-ajax.IAuWidgetAjaxConfig/"
---

# au-widget-ajax/IAuWidgetAjaxConfig

> Provides HTTP response properties.

## Classes

### ResponseErrorContext

#### Constructors

##### Constructor

```ts
new ResponseErrorContext(): ResponseErrorContext;
```

###### Returns

[`ResponseErrorContext`](#responseerrorcontext)

#### Properties

##### body

```ts
body: any;
```

The response body.

##### headers

```ts
headers: Headers;
```

A dictionary of HTTP headers sent along with the response.

##### statusCode

```ts
statusCode: number;
```

An HTTP response status code.

## Interfaces

### 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.
```json
{
  "widgets": [
   {
     "name": "gallery-images",
     "type": "ajax",
     "params": {
       "lock": "gallery",
       "url": "https://example.com/api/images?subfolder=cats",
       "method": "GET",
       "responseType": "json"
     }
   }
 ]
}
```

#### Properties

##### enabled

```ts
enabled: boolean;
```

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

##### headers

```ts
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).

###### Index Signature

```ts
[key: string]: string
```

##### lock

```ts
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

```ts
method: string;
```

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

##### onError

```ts
onError: Function | Function[];
```

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

##### onSuccess

```ts
onSuccess: Function | Function[];
```

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

##### request

```ts
request: any;
```

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

##### requests

```ts
requests: any[];
```

##### responseType

```ts
responseType: ResponseType;
```

Defines how to interpret the response received from the server.

##### url

```ts
url: string;
```

A URL that is used to accept requests.

***

### IRequestModel

Provides HTTP request properties.

#### Properties

##### enabled

```ts
enabled: boolean;
```

If `false`, the request will not be executed.

##### headers

```ts
headers: object;
```

A dictionary of HTTP headers sent along with the request.

###### Index Signature

```ts
[key: string]: string
```

##### method

```ts
method: string;
```

An HTTP method.

##### request

```ts
request: any;
```

The request body.

##### responseType

```ts
responseType: ResponseType;
```

Defines how to interpret the response received from the server.

##### url

```ts
url: string;
```

A URL that is used to accept requests.

## Type Aliases

### ErrorsCallback

```ts
type ErrorsCallback = (errorData) => void;
```

Defines a function that should work when a request fails.

#### Parameters

| Parameter | Type |
| ------ | ------ |
| `errorData` | [`ResponseErrorContext`](#responseerrorcontext) |

#### Returns

`void`

***

### ResponseType

```ts
type ResponseType = "text" | "blob" | "json" | "blob_url" | "status_code";
```

A response type specifying how to interpret the response received from the server.

#### Text

- a raw text string. The Ajax widget does not try to interpret it.

#### Json

- a JSON object. When you refer the `response` in your config, you can access its properties.

#### Blob

- binary data. It makes sense to use it along with some widgets that can work with binary data directly.
@blob_url - binary data, but it is converted to the Blob URL, which can be used with HTML markup.
@status_code - an HTTP code.
