# Class: xhr

## LuCI. xhr

The `LuCI.xhr` class is a legacy compatibility shim for the functionality formerly provided by `xhr.js`. It is registered as global `window.XHR` symbol for compatibility with legacy code.

New code should use `LuCI.request` instead to implement HTTP request handling.

#### new LuCI.xhr()

luci.js, line 3274
  Deprecated
    - Yes

### Methods

#### abort()

luci.js, line 3390

  Ignored for backwards compatibility.

  This function does nothing.

  Deprecated
    - Yes

#### busy(){boolean}

luci.js, line 3379

  Checks the running state of the request.

  Deprecated
    - Yes

  ##### Returns:

  Type | Description
  --- | ---
  boolean | Returns `true` if the request is still running or `false` if it already completed.

#### cancel()

luci.js, line 3366

  Cancels a running request.

  This function does not actually cancel the underlying `XMLHTTPRequest` request but it sets a flag which prevents the invocation of the callback function when the request eventually finishes or timed out.

  Deprecated
    - Yes

#### get(url, data, callback, timeout){Promise.<null>}

luci.js, line 3322

  This function is a legacy wrapper around `LuCI.get()`.

  Name | Type | Description
  --- | --- | ---
  `url` | string | The URL to request
  `data` | Object | optional Additional query string data
  `callback` | LuCI.requestCallbackFn | optional Callback function to invoke on completion
  `timeout` | number | optional Request timeout to use

  Deprecated
    - Yes

  ##### Returns:

  Type | Description
  --- | ---
  Promise.<null> |

#### post(url, data, callback, timeout){Promise.<null>}

luci.js, line 3349

  This function is a legacy wrapper around `LuCI.post()`.

  Name | Type | Description
  --- | --- | ---
  `url` | string | The URL to request
  `data` | Object | optional Additional data to append to the request body.
  `callback` | LuCI.requestCallbackFn | optional Callback function to invoke on completion
  `timeout` | number | optional Request timeout to use

  Deprecated
    - Yes

  ##### Returns:

  Type | Description
  --- | ---
  Promise.<null> |

#### send_form()

luci.js, line 3405

  Existing for backwards compatibility.

  This function simply throws an `InternalError` when invoked.

  Deprecated
    - Yes

  ##### Throws:

  Throws an `InternalError` with the message `Not implemented` when invoked.

  Type
    InternalError