# jquery.csrf

> Set CSRF token header for jQuery.

Latest version **0.1.2** (published 2022-02-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install jquery.csrf
pnpm add jquery.csrf
yarn add jquery.csrf
bun add jquery.csrf
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.2 |
| Published | 2022-02-01 |
| First published | 2017-02-25 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 1 |
| Author | Jianqiu Xiao |
| Maintainers | swordray |

## Links

- npm: https://www.npmjs.com/package/jquery.csrf
- Repository: https://github.com/swordray/jquery.csrf
- Homepage: https://bailushuyuan.org/
- npm.io page: https://npm.io/package/jquery.csrf

## Recent versions

- 0.1.2 (latest) — 2022-02-01
- 0.1.1 — 2022-01-31
- 0.1.0 — 2017-02-25

## README

jquery.csrf
===========

Set CSRF token header for jQuery.

## Installation

* Yarn

  ```bash
  yarn add jquery.csrf
  ```

* NPM

  ```bash
  npm install jquery.csrf
  ```

## Usage

1. Include jQuery and jquery.csrf.js:

  ```html
  <script src="https://code.jquery.com/jquery.js"></script>
  <script src="jquery.csrf.js"></script>
  ```

2. Include `meta` tag in your page with the CSRF-token:

  ```html
  <meta name="csrf-token" content="myCSRFtoken">
  ```

3. Now, whenever you make AJAX request using jQuery, `X-CSRF-Token` will be set to `myCSRFtoken`.

  ```js
  // Example:
  $("body").load("ajax/test.html");
  ```

## Sponsors

* [BaiLu ShuYuan](https://bailushuyuan.org)

## License

Copyright © 2017 Jianqiu Xiao <swordray@gmail.com> under The [MIT License](http://opensource.org/licenses/MIT).

---
_Source: https://npm.io/package/jquery.csrf · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
