My script is not working.
"sb-pdfs/" is the path where the file is located that I want to delete. If I substitute the $_GET part with the correct file name and call the php scripts directly, then the file is in fact deleted, but not when I try to do it with the Ajax function. I could also just substitute the php with a simple echo which is not called either.
<?php
unlink ('sb-pdfs/'+($_GET['file']));
?>
So the error seems to be on the AJAX side:
function loeschen(clicked_id)
{
alert(clicked_id);
$.ajax({
url: 'unlink.php',
data: {'file' : clicked_id },
success: function (response) {
if( response.status === true ) {
alert('File Deleted!');
}
else alert('Did not work!');
}
});
}
I get the correct clicked_id alert, but also the "Did not work!" alert and the file is not deleted.
Edit: clicked_id is the filename of the file I want to delete.