Editor: SyntaxError: function statement requires a name
Editor: SyntaxError: function statement requires a name
Philwn
Posts: 7Questions: 3Answers: 0
Using the genrator I had the following javascript:
function($){
$(document).ready(function() {
var editor = new $.fn.dataTable.Editor( {
ajax: '{!!route('projects.data')!!}',
table: '#projects',
fields: [
{
"label": "Project:",
"name": "proj"
},
{
"label": "Title:",
"name": "title"
},
{
"label": "Launch Date:",
"name": "launchdate",
"type": "datetime",
"format": "ddd, D MMM YY"
}
]
} );
var table = $('#projects').DataTable( {
dom: 'Bfrtip',
ajax: '{!!route('projects.data')!!}',
columns: [
{
"data": "proj"
},
{
"data": "title"
},
{
"data": "launchdate"
}
],
select: true,
lengthChange: false,
buttons: [
{ extend: 'create', editor: editor },
{ extend: 'edit', editor: editor },
{ extend: 'remove', editor: editor }
]
} );
} );
}(jQuery));
But I recieve the error:
SyntaxError: function statement requires a name
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
Hi Philwn
I believe you are missing an opening parenthesis on line 1
function($){
Should be
(function($){
Thanks
Tom
I was, I actually found it about half an hour after I posted this. Thank you for your answer