php – ajax call with post returning nothing-ThrowExceptions

Exception or error:
$.ajax({
    url: "read_files.php",
    method: "POST",
    contentType: false,
    cache: false,
    processData: false,
    success(data){
        fileContainer.innerHTML = data;
        containerPopUp.style.display = "none";        

        const fileUploaders =Array.from(document.querySelectorAll(".file-uploader"));

        fileUploaders.map((fileUploader)=>{
            fileUploader.addEventListener("click",(e)=>{
                const file_id = e.target.parentNode.childNodes[1].getAttribute("value");
                console.log("data coming from js ",file_id);
                $.ajax({
                    url: "delete_file.php",
                    method:"post",
                    contentType: false,
                    cache: false,
                    data : {"fileId" : file_id},
                    processData: false , 
                    success(data){
                        console.log(data);
                    }
                })
            })
        })        


    }

})

and this is the PHP code

<?php
$img_id = $_POST["fileId"];

echo "data ->" . $img_id;
?>
How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *