3
I was developing this code and the following error was generated:
Uncaught Syntaxerror: Unexpected token {
$(document).ready(function() {
editor = new $.fn.dataTable.Editor( {
ajax: "../php/staff.php",
table: "#publicationTable",
fields: [ {
label: "Visualizado:",
name: "p.id_Publication"
}, {
label: "Título da Publicação:",
name: "ti.PublicationTitle"
}, {
label: "Tipo de Publicação:",
name: "ty.PublicationType"
}, {
label: "Ano:",
name: "p.ano"
}, {
label: "Mês:",
name: "p.competencia"
}, {
label: "Empresa:",
name: "c.razaoSocial"
}, {
label: "Favorecido:",
name: "e.nome"
}
]
} );
var table = $('#publicationTable').DataTable( {
lengthChange: true,
ajax: "../php/staff.php",
columns: [
{ data: "p.status",
render: function ( data, type, row ) {
var text = "";
if (type == "display") {
if (data == "1") {
text = "<i class='ace-icon fa fa-circle green'></i>";
} else {
text = "<i class='ace-icon fa fa-circle red'></i>";
}
data = text
}
return data;
},
}
{ data: "ti.PublicationTitle" },
{ data: "ty.PublicationType" },
{ data: "p.ano" },
{ data: "p.competencia" },
{ data: "c.razaoSocial" },
{ data: "e.nome" }
],
} );
} );
I would like to know why this mistake is occurring, and how can I resolve it?
The two answers are working, it wasn’t just one to work?
– UzumakiArtanis
I voted for the other because it was the one that answered first
– UzumakiArtanis