Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

laravel jquery csrf

In header

<meta name="csrf-token" content="{{ csrf_token() }}" />
  
In script

<script type="text/javascript">
$.ajaxSetup({
    headers: {
        'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
    }
});
</script>
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #laravel #jquery #csrf
ADD COMMENT
Topic
Name
1+6 =