php - Token Mismatch exception when ajax Delete request sent in Laravel 5 when I change project folder -


i used dropzone.js upload images. when want delete image, sent ajax delete request image controller.

        mydropzone.on("removedfile", function(file) {                   console.log(file.name);             console.log(uploadedimages[file.name]);             var csrf = $('input[name=_token]').val();             // var csrf = $('meta[name="_token"]').attr('content');             console.log(csrf);            var request = $.ajax({                 url: "/cms/image/"+uploadedimages[file.name],                 headers: {                     'x-csrf-token': csrf ,                     "accept": "application/json"                 },                 type: "delete",                 data: {  "id": uploadedimages[file.name] },                 error: function(jqxhr, textstatus, errorthrown) {                     // alert('http error: '+errorthrown+' | error message: '+textstatus);                     console.log(errorthrown);                 }, 

that method sent controller delete request in old project.

but merge in other project, got error.

tokenmismatchexception in verifycsrftoken.php

i don't understand why exception occur. please explain me that. , respect geeks.

you can try putting token in sent data

data: {      "_token": "{{ csrf_token() }}",    "id": uploadedimages[file.name]  }, 

Comments

Popular posts from this blog

node.js - Mongoose: Cast to ObjectId failed for value on newly created object after setting the value -

gradle error "Cannot convert the provided notation to a File or URI" -

[C++][SFML 2.2] Strange Performance Issues - Moving Mouse Lowers CPU Usage -