hummingbird-me/hummingbird — pull request #14 by NuckChorris (2014-06-06 22:09:48+00:00)
Title: Add CSRF token to AJAX, should fix sign out issues

Based on the discussion on [the forums](http://forums.hummingbird.me/t/sign-out-button-does-nothing-when-viewing-a-users-library/5619), this adds the CSRF token to AJAX using `jQuery.ajaxPrefilter`.

I optimized a bit more than your examples of other solutions, by creating closed-over variables for the csrfToken and csrfParam, instead of loading them from DOM before every request.

#### Caveats:
I wasn't sure what the JS style ought to be so I just went with semicolons and 2-space indents based on nearby files — if you would prefer something else (I know I'd prefer tabs lol) I'll amend the commit. You should probably add a short style guide (with stuff like indentation and semicolon-usage) to `CONTRIBUTING.md`.

Also I have no idea where else to cram it so I just put it in the `lib/` JS directory. Once again, if this is wrong, I can amend the commit and force-push