From 25d162f90da4f360c87ecf48e189b666df590dfa Mon Sep 17 00:00:00 2001 From: JAMES ZHANG Date: Wed, 20 Apr 2016 11:03:29 -0500 Subject: [PATCH] add csrf protection in js --- public/js/demo.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/public/js/demo.js b/public/js/demo.js index 6202175a..4be0cc60 100755 --- a/public/js/demo.js +++ b/public/js/demo.js @@ -21,6 +21,14 @@ * JQuery on ready callback function */ function ready() { + + // CSRF protection + $.ajaxSetup({ + headers: { + 'csrf-token': $('meta[name="ct"]').attr('content') + } + }); + // load all json data first $.when( $.ajax('/data/threshold_v0.1.1.json'),