mercredi 28 novembre 2018

Unable to make POST request using FETCH

I am trying to make a POST request using FETCH but I am getting this error - 419 (unknown status)

This is my code:

fetch(url, {
    method: "post", headers: {'Content-Type': 'application/json'}, mode: 'no-cors',
   body: {
       _token: '{!! csrf_token() !!}',
   }
   }).then(function(response) {
       return response.json();
   })

I have also added <meta name="csrf-token" content=""> in the head section.



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2KEzJ7p
via IFTTT

Aucun commentaire:

Enregistrer un commentaire