Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/swordray/jquery.csrf
Set CSRF token header for jQuery.
https://github.com/swordray/jquery.csrf
csrf csrf-token jquery
Last synced: 8 days ago
JSON representation
Set CSRF token header for jQuery.
- Host: GitHub
- URL: https://github.com/swordray/jquery.csrf
- Owner: swordray
- License: mit
- Created: 2015-09-09T06:26:38.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2022-02-01T03:34:38.000Z (almost 3 years ago)
- Last Synced: 2024-05-29T06:57:41.540Z (6 months ago)
- Topics: csrf, csrf-token, jquery
- Language: JavaScript
- Homepage:
- Size: 3.91 KB
- Stars: 1
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
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
```2. Include `meta` tag in your page with the CSRF-token:
```html
```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 under The [MIT License](http://opensource.org/licenses/MIT).