I have this foreach ()
<?php foreach($fotos_ingresso as $valor){ ?>
<div id="fotos-listagem-imagem">
<a href="javascript:;" data-toggle="modal" data-target="#confirma-deletar-imagem" data-href="#" data-id="<?php echo $valor->inf_id; ?>" id="deletar-imagem"><img src="<?php echo base_url('assets/uploads/interno_fotos/'.$valor->inf_tipo.'/'.$valor->inf_imagem); ?>" class="img-responsive corte-imagem"></a>
</div>
<?php } ?>
Inside it, I'm passing id="delete-image" and also the data-id.
How can I recover the data-id? I did it as follows:
$('#confirma-deletar-imagem').on('show.bs.modal', function(e) {
var inf_id = $(this).attr('data-id');
});
In this case it is returning nullo. When I click on the image, I open a modal confirmation ... And when I click, you should call Ajax to remove it. However, I do not even know how to call ajax to remove, after clicking on the button called delete-image-modal.
How can I do this?