Skip to content

Instantly share code, notes, and snippets.

@vikasavnish
Last active October 17, 2017 17:43
Show Gist options
  • Save vikasavnish/6be718afcf5f0d26337800727ea8c22e to your computer and use it in GitHub Desktop.
Save vikasavnish/6be718afcf5f0d26337800727ea8c22e to your computer and use it in GitHub Desktop.
//setup
$.ajaxSetup({
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
}
});
// Actual ajax
$.post(submittarget,{data:data},function(e){
console.log(e);
});
//setting the csrf token in meta
<meta name="csrf-token" content="{{ csrf_token() }}">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment