with a jquery function I fill a table with the data I need and I have two buttons in the table one for the details of that element and the other to edit it that will allow me to access a url given the element listed in the table, as I do to link the urls to the buttons and pass the id of that element this is a part of the function:
$.post($(this).attr('data-url'), $(this).serializeArray(), function (data) {
// console.log(data);
table_busqueda_pregunta.clear().draw();
data.forEach(function (pregunta){
table_busqueda_pregunta.row.add([
pregunta.descripcion,
pregunta.autor,
pregunta.fecha,
pregunta.nivel,
"<a class='btn btn-primary' style='margin-right: 10px;'><span class='glyphicon glyphicon-info-sign'></span></a>" +
"<a class='btn btn-primary'><span class='glyphicon glyphicon-pencil'></span></a>"
]).draw(false);
});
// console.log("Success!");
}, 'json');