Witajcie,
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" id="46">[delete http://www.php.net/file]</a> </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" id="47">[delete http://www.php.net/file]</a> </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" id="48">[delete http://www.php.net/file]</a> </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" id="49">[delete http://www.php.net/file]</a> </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" id="50">[delete http://www.php.net/file]</a> </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" id="51">[delete http://www.php.net/file]</a> </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" id="52">[delete http://www.php.net/file]</a> </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(); } });
Debugować.
Wygeneruj podczas usuwania nowy token, zwróć wraz z odpowiedzią i wstaw do <meta>.
Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)