I solved this actually.:
I put:
<input type="hidden" id="csrf_token" value="{{ csrf_token() }}"/>
in the view where the form is rendered.
Then I pulled out the value in js :
csrf_token = document.getElementById('csrf_token');
and put it in the form like this:
<input type="hidden" name="_token" value="'+csrf_token.value+'">\
How about sending it as a cookie? And then use a filter to check this cookie? If you mark your cookie as HTTP secure, then all request will send this. And you don't need to JavaScript worry about it.
Sign in to participate in this thread!
The Laravel portal for problem solving, knowledge sharing and community building.
The community