Created
September 27, 2014 10:54
-
-
Save kmdsbng/e036ee01afd46e00506d to your computer and use it in GitHub Desktop.
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
| $.ajaxSetup({ | |
| beforeSend: function(xhr, settings) { | |
| if (settings.type == 'POST' || settings.type == 'PUT' || settings.type == 'DELETE') { | |
| if (!(/^http:.*/.test(settings.url) || /^https:.*/.test(settings.url))) { | |
| // Only send the token to relative URLs i.e. locally. | |
| xhr.setRequestHeader("X-CSRF-Token", $('meta[name="csrf-token"]').attr('content')); | |
| } | |
| } | |
| } | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment