I am sending some data to my server via $AJAX, now i keep getting the
Token Mismatch Exception Error
.
When i use $http i do not get this error so i do not understand what makes $AJAX soo different. I have checked online for solutions but all the solutions involved doing something like this:
<meta name="csrf-token" content="{{ csrf_token() }}">
Thing is i do not use blade, my client code is completely independent of any server code so using methods like that is not an option, plus i also had a situation in the past where i had to refresh my application after making a post before i could make another post using that method, i dunno why.
What i am basically asking is how to GET CSRF Token from the server using only javascript and SET it in my header in my AJAX request without any server code.
I am using Jquery AJAX for this NOT the $http service in AngularJS
The GET part is the main issue here.