I have three scripts
The first one dynamically generates a form that contain several inputs whose values contain the id_mensaje I'm intereted in. I want to delete the mysql registries related to the id_mensaje. I'd rather show you the scripts
1.- correo.php
<div id='eliminar_mensaje'><a href='#'>Eliminar</a> </div>
<form>
<input class='elim_msg' type='checkbox' value='id_mensaje_".$i."' />
... more inputs whith same class name
</form>
2.- correo.js
$('#eliminar_mensaje a').on('click', function(){
$('#loading').show();
$('.elim_msg').each(function(i,e){
var value = $(e).val();
var checked = $(e).prop('checked');
if(value != 'ok' && checked == true){
$.ajax({
url: 'private/control_correo.php',
type: 'POST',
data: 'id_mensaje='+value+'&accion=eliminar_mensaje'
});
} else {
//do nothing
}
});
location.reload(true);
return false;
});
3.- control_correo.php
...} else if(isset($_POST['accion']) AND $_POST['accion'] == 'eliminar_mensaje'){
consultav2("DELETE FROM destinatarios WHERE id_mensaje = '".$_POST['id_mensaje']."';");
consultav2("DELETE FROM mensajes WHERE id_mensaje = '".$_POST['id_mensaje']."';");
}
When you click on the link whithin the eliminar_mensaje div it looks that the javascript code works but it really doesn't for any reason i'm not able to find.
does any of you see anything in the scripts?
Tanks a lot in advance!