samedi 24 octobre 2015

Laravel 5.1 xmlHttpRequest AJAX POST TokenMismatchException

The relevant code is shown below:

var csrfToken = "{{ csrf_token() }}";
xmlhttp.open("POST", "/internal/v1/create/strategy", true);
xmlhttp.setRequestHeader('X-CSRF-TOKEN', csrfToken);
postString = "param1=" + varOne + "?param2=" + varTwo;
xmlhttp.send(postString);

I've been trying to figure this out for hours now, I honestly have no idea what to do at this point. Note, that if I use the form method everything works just fine. I've also tried sending the CSRF token as a parameter in the postString: "_token=" + csrfToken



from Newest questions tagged laravel-5 - Stack Overflow http://ift.tt/1LumVLg
via IFTTT

Aucun commentaire:

Enregistrer un commentaire