jquery.csrf

0.1.2 • Public • Published

jquery.csrf

Set CSRF token header for jQuery.

Installation

  • Yarn

    yarn add jquery.csrf
  • NPM

    npm install jquery.csrf

Usage

  1. Include jQuery and jquery.csrf.js:
<script src="https://code.jquery.com/jquery.js"></script>
<script src="jquery.csrf.js"></script>
  1. Include meta tag in your page with the CSRF-token:
<meta name="csrf-token" content="myCSRFtoken">
  1. Now, whenever you make AJAX request using jQuery, X-CSRF-Token will be set to myCSRFtoken.
// Example:
$("body").load("ajax/test.html");

Sponsors

License

Copyright © 2017 Jianqiu Xiao swordray@gmail.com under The MIT License.

/jquery.csrf/

    Package Sidebar

    Install

    npm i jquery.csrf

    Weekly Downloads

    11

    Version

    0.1.2

    License

    MIT

    Unpacked Size

    2.4 kB

    Total Files

    5

    Last publish

    Collaborators

    • swordray