Good morning.
Does anyone know how to do in jquery to capture some data from a tag within a dynamically generated table ? In fact everything inside the "showPesqReserve" div is generated dynamically.
Ex:
<div id="showPesqReserva">
<div id="calendar">
<table id="tabela">
<tr>
<td><a role="button" class="dayReserve" data-dia="2016-01-15" data-local="sala1" data-horario="17:30">15</a></td>
</tr>
</table>
</div>
</div>
I'm doing it this way but it's not working. It does not generate an error and nothing happens when clicking:
$("#tabela").on("click", "a", function(event){
var iData = $(this).data("dia");
var iLocal = $(this).data("local");
var iHorario = $(this).data("horario");
event.prevendDefault();
$.ajax({
type: "GET",
url: "fazalgumacoisa.php",
data: "dia="+iData + "&espaco="+iLocal + "&horas="+iHorario,
dataType: "html",
...
})
return false;
});