Problems with AJAX

2

I'm trying to delete a photo with ajax.

I was able to collect the data (location of the photo) and now I was trying to receive the same location with another .php file.

What is failing me is this same "transfer". I think I did everything right, but I still can not receive the data.

This is the code

<script type="text/javascript">
$( ".delete" ).click(function() {
    var element = $(this);
    var original_url = element.attr('original_place');
    var thumbnail_url = element.attr('thumbnail_place');

if (confirm('Tem a certeza?')){
    $.ajax({
        type: 'POST',
        url: 'apagar_foto.php',
        data:{foto_original:original_url,foto_thumb:thumbnail_dir,},
        success: function()
        {
            alert('Eliminado');
        }       
    });
};
return false;
});
</script>

As you can see, I save the locations of the photos in 2 variables.

After a short confirmation I send the

Code you were supposed to receive the data

$foto_original = $_POST['foto_original'];
$foto_thumb = $_POST['foto_thumb'];

echo "<script type='text/javascript'>alert('$foto_original');</script>";
echo "<script type='text/javascript'>alert('$foto_thumb');</script>";
Can you tell me where the error might be? I apologize for this simple question, but this has not left me for some time. Thank you.

    
asked by anonymous 28.06.2017 / 16:47

0 answers