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 wonder why this error is occurring, and how can I resolve it?