diff --git a/static/js/csrf.js b/static/js/csrf.js index 5cd60973f8..fb83de565a 100644 --- a/static/js/csrf.js +++ b/static/js/csrf.js @@ -1,18 +1,9 @@ var csrf_token; $(function () { // This requires that we used Jinja2's {% csrf_input %} somewhere on the page. - var csrf_input = $('input[name="csrfmiddlewaretoken"]'); - if (csrf_input.length > 0) { - csrf_token = csrf_input.attr('value'); - } else { - csrf_token = undefined; - } + csrf_token = $('input[name="csrfmiddlewaretoken"]').attr('value'); window.csrf_token = csrf_token; - if (csrf_token === undefined) { - return; - } - $.ajaxSetup({ beforeSend: function (xhr, settings) { if (!(/^http:.*/.test(settings.url) || /^https:.*/.test(settings.url))) {