I'm trying to trigger an event attached to a html tag
This table is builded insde a function
function detail(id){
console.log(id)
}
function search(data){
$.post(url, {valorBusqueda: textoBusqueda}, function(data) {
data = JSON.parse(data);
$.each(data, function(i, val){
id = val.id;
html += '<tr onclick="detail('+id+')">';
html += '<tr>';
}
});
});
}
But when I click the element I get this err:
Uncaught ReferenceError: detallePaciente is not defined
when is actually defined in my file
any idea how could I solve this?