0
Good morning.
Can anyone tell me how to use jquery to capture some data from a tag within a dynamically generated table? In fact everything within the div "showPesqReserva" 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 doesn’t generate 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;
});
Hello Thomas. Now it worked out! Thank you very much. I had tried everything.
– Francisco
Vlw @Francisco!
– Thomas Lima