I used Dropzone.js to upload an image. When I want to delete the image, I sent the Ajax delete request to the Image Controller.
myDropzone.on ("deleted file", function {file} {console.log (file.name); console log (uploaded images [file.name]); var csrf = $ ('Input [name = _token]'). Val (); // var csrf = $ ('meta [name = "_ token"]') .tr ('content'); console.log (csrf) ; Var request = $ .ajax ({url: "/cms/image/"+uploadedImages[file.name}, header: {'X-CSRF-Token': CSRF," Approved ":" Application / JS "}, Type: "DELETE", Data: {"id": uploaded images [file.name]}, error: function (jqXHR, textStatus, errorThrown) {// warning ('HTTP Error:' + ErrorThrown + '| Error message: '+ textStatus; console.log (errorThrown);},
Eliminate the request in my old project with the error sent to successfully control that method.
But I merged into another project, error me I do not understand why this is the exception. Please tell me about it Thank you for all the geeks.
and respect.
You can try to insert a token in the data sent
Data: {"_token": "{{csrf_token ()}", "id": uploaded images [file.name]},
No comments:
Post a Comment