---
title: "Ajax"
---
# Ajax

Defined in: [src/core/request/ajax.ts:40](https://github.com/xdan/jodit/blob/main/src/core/request/ajax.ts#L40)

## Type Parameters

| Type Parameter | Default type |
| ------ | ------ |
| `T` *extends* `object` | `any` |

## Implements

- [`IAjax`](../interfaces/types.IAjax.html)\<`T`\>

### Constructor

**new Ajax**\<`T`\>(`options`, `defaultAjaxOptions?`): `Ajax`\<`T`\>

Defined in: [src/core/request/ajax.ts:47](https://github.com/xdan/jodit/blob/main/src/core/request/ajax.ts#L47)

#### Parameters

| Parameter | Type | Default value |
| ------ | ------ | ------ |
| `options` | [`Partial`](https://www.typescriptlang.org/docs/handbook/utility-types.html#partialtype)\<[`AjaxOptions`](../interfaces/types.AjaxOptions.html)\> | `undefined` |
| `defaultAjaxOptions` | [`AjaxOptions`](../interfaces/types.AjaxOptions.html) | `Config.prototype.defaultAjaxOptions` |

#### Returns

`Ajax`\<`T`\>

### log

`static` **log**: [`IRequest`](../interfaces/types.IRequest.html)[] = `[]`

Defined in: [src/core/request/ajax.ts:59](https://github.com/xdan/jodit/blob/main/src/core/request/ajax.ts#L59)

***

### options

**options**: [`AjaxOptions`](../interfaces/types.AjaxOptions.html)

Defined in: [src/core/request/ajax.ts:90](https://github.com/xdan/jodit/blob/main/src/core/request/ajax.ts#L90)

#### Implementation of

[`IAjax`](../interfaces/types.IAjax.html).[`options`](../interfaces/types.IAjax.html#options)

#### Get Signature

**get** **o**(): `this`\[`"options"`\]

Defined in: [src/core/request/ajax.ts:91](https://github.com/xdan/jodit/blob/main/src/core/request/ajax.ts#L91)

##### Returns

`this`\[`"options"`\]

#### Implementation of

[`IAjax`](../interfaces/types.IAjax.html).[`o`](../interfaces/types.IAjax.html#o)

### className()

**className**(): `string`

Defined in: [src/core/request/ajax.ts:41](https://github.com/xdan/jodit/blob/main/src/core/request/ajax.ts#L41)

#### Returns

`string`

***

### abort()

**abort**(): `Ajax`

Defined in: [src/core/request/ajax.ts:95](https://github.com/xdan/jodit/blob/main/src/core/request/ajax.ts#L95)

#### Returns

`Ajax`

#### Implementation of

[`IAjax`](../interfaces/types.IAjax.html).[`abort`](../interfaces/types.IAjax.html#abort)

***

### send()

**send**(): [`RejectablePromise`](../interfaces/types.RejectablePromise.html)\<[`IResponse`](../interfaces/types.IResponse.html)\<`T`\>\>

Defined in: [src/core/request/ajax.ts:112](https://github.com/xdan/jodit/blob/main/src/core/request/ajax.ts#L112)

#### Returns

[`RejectablePromise`](../interfaces/types.RejectablePromise.html)\<[`IResponse`](../interfaces/types.IResponse.html)\<`T`\>\>

#### Implementation of

[`IAjax`](../interfaces/types.IAjax.html).[`send`](../interfaces/types.IAjax.html#send)

***

### stream()

**stream**(): [`AsyncGenerator`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/AsyncGenerator)\<`string`\>

Defined in: [src/core/request/ajax.ts:205](https://github.com/xdan/jodit/blob/main/src/core/request/ajax.ts#L205)

Send request and stream SSE (Server-Sent Events) data incrementally.
Uses XHR onprogress to read responseText as it grows,
parses SSE `data:` lines and yields each event's data as a string.

Aborting the XHR (via abort/destruct) or breaking out of the loop
will properly terminate the stream.

#### Returns

[`AsyncGenerator`](https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/AsyncGenerator)\<`string`\>

#### Implementation of

[`IAjax`](../interfaces/types.IAjax.html).[`stream`](../interfaces/types.IAjax.html#stream)

***

### prepareRequest()

**prepareRequest**(): [`IRequest`](../interfaces/types.IRequest.html)

Defined in: [src/core/request/ajax.ts:329](https://github.com/xdan/jodit/blob/main/src/core/request/ajax.ts#L329)

#### Returns

[`IRequest`](../interfaces/types.IRequest.html)

#### Implementation of

[`IAjax`](../interfaces/types.IAjax.html).[`prepareRequest`](../interfaces/types.IAjax.html#preparerequest)

***

### destruct()

**destruct**(): `void`

Defined in: [src/core/request/ajax.ts:369](https://github.com/xdan/jodit/blob/main/src/core/request/ajax.ts#L369)

#### Returns

`void`

#### Implementation of

[`IAjax`](../interfaces/types.IAjax.html).[`destruct`](../interfaces/types.IAjax.html#destruct)
