-
-
Save haileys/2785862 to your computer and use it in GitHub Desktop.
Django ajax csrf coffeescript
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document = cookie: "hello=world;this=that;what=which" | |
getCookie = (name) -> | |
if document.cookie | |
for [_, k, v] in (/^(.*?)=(.*)$/.exec kv for kv in document.cookie.split ";") | |
if k is name | |
return decodeURIComponent v | |
console.log getCookie "this" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment