$( document ).ready(function() { // hook into jquery ajax requests to ensure csrf handling. $.ajaxSetup({ 'beforeSend': function(xhr) { xhr.setRequestHeader("X-CSRFToken", "----------------------------------------" ); xhr.setRequestHeader("X-CSRFTokenKey", "----------------------------------------" ); } });