Mam taki kod:
<ul> <li class="file-id-46">- <a href="http://test.test/upload/other/1c186a1229c8c502c9bae2794b52a6f0.pdf" target="_blank">upload/other/1c186a1229c8c502c9bae2794b52a6f0.pdf</a> <a href="#" class="red removeThisFile" </li> <li class="file-id-47">- <a href="http://test.test/upload/other/65b13b47f09fc785d901e43e7864bab2.pdf" target="_blank">upload/other/65b13b47f09fc785d901e43e7864bab2.pdf</a> <a href="#" class="red removeThisFile" </li> <li class="file-id-48">- <a href="http://test.test/upload/other/19846324513791f79013fb8e5a7854d8.pdf" target="_blank">upload/other/19846324513791f79013fb8e5a7854d8.pdf</a> <a href="#" class="red removeThisFile" </li> <li class="file-id-49">- <a href="http://test.test/upload/other/fca69b7c02ae223cd167202368d3a555.pdf" target="_blank">upload/other/fca69b7c02ae223cd167202368d3a555.pdf</a> <a href="#" class="red removeThisFile" </li> <li class="file-id-50">- <a href="http://test.test/upload/other/2a1f88cd9f223a423a29594be3d8ce7a.pdf" target="_blank">upload/other/2a1f88cd9f223a423a29594be3d8ce7a.pdf</a> <a href="#" class="red removeThisFile" </li> <li class="file-id-51">- <a href="http://test.test/upload/other/dbe585a9716bd417437be6b0d5695a6a.pdf" target="_blank">upload/other/dbe585a9716bd417437be6b0d5695a6a.pdf</a> <a href="#" class="red removeThisFile" </li> <li class="file-id-52">- <a href="http://test.test/upload/other/585b8aa2cfd6a871eb3ed0e1c6d5e2b9.pdf" target="_blank">upload/other/585b8aa2cfd6a871eb3ed0e1c6d5e2b9.pdf</a> <a href="#" class="red removeThisFile" </li> </ul> $(".removeThisFile").click(function () { var id = $(this).attr("id"); $('.file-id-' + id).hide(); $.ajax({ url: 'http://test.test/psCMS/removeOtherFile?id=52', type: 'get', dataType: 'json', _token: $('meta[name="_token"]').attr('content'), headers: { 'X-CSRF-TOKEN': $('meta[name="_token"]').attr('content') }, cache: false, success: function (response) { $(this).hide(); } });
Generalnie jquery poprawnie wysyła zapytanie do php (Laravel).
Problem występuje w kasowaniu plików. Pierwszy plik zostaje usunięty poprawnie. Usnięcie kolejnego pliki nie udaje się.
Podejrzewam iż mam nieważny token X-CSRF-TOKEN po usunięciu poprzedniego pliku.
W jaki sposób mogę naprawić ten problem?