У меня следующее сомнение / проблема.Мне нужно использовать некоторые идентификаторы, которые загружаются скриптом Handlebars.Как только я получу значения, таблицу, я хотел бы иметь возможность выполнить еще один ajax-вызов, если я нажму кнопку
Вот код:
HTML:
div class="container">
<table class="table">
<thead class="thead-dark">
<tr>
<th scope="col">Nombre</th>
<th scope="col">Valor</th>
<th scope="col">Tipo</th>
<th scope="col">Cron</th>
<th scope="col"></th>
<th scope="col"></th>
</tr>
</thead>
<tbody class= "tbody">
<script id="properties-template" type="text/x-handlebars-template">
{{#each properties}}
<tr>
<th>{{clave}}</th>
<td>{{valor}}</td>
<td>{{variable}}</td>
<td>{{cron}}</td>
<td><button class="btn"><i class="fa fa-pencil"></i></button></td>
<td><button class="btn"><i class="fa fa-trash" id="{{id}}" style="color:red"></i></button></td>
</tr>
{{/each}}
</script>
</tbody>
</table>
</div>
JS:
$(document).ready(function(){
$.ajax({
url: URL_address,
success: function(data){
var source = $("#properties-template").html();
var template = Handlebars.compile(source);
$('.tbody').append(template(data));
},
error: function(data) {
console.log('error', data);
}
})
});
Я пытался добиться того, что мне нужно, $ (". Fa-trash"). Нажмите (..), но я получил неопределенное значение.Как я могу это сделать?