SyntaxError: missing ) after argument list
For me, once there was a mistake in spelling of function
For e.g. instead of
$(document).ready(function(){
});
I wrote
$(document).ready(funciton(){
});
So keep that also in check
You had a unescaped "
in the onclick handler, escape it with \"
$('#contentData').append("<div class='media'><div class='media-body'><h4 class='media-heading'>" + v.Name + "</h4><p>" + v.Description + "</p><a class='btn' href='" + type + "' onclick=\"(canLaunch('" + v.LibraryItemId + " '))\">View »</a></div></div>")
I faced the same issue in below scenario yesterday. However I fixed it as shown below. But it would be great if someone can explain me as to why this error was coming specifically in my case.
pasted content of index.ejs file that gave the error in the browser when I run my node file "app.js". It has a route "/blogs" that redirects to "index.ejs" file.
<%= include partials/header %>
<h1>Index Page</h1>
<% blogs.forEach(function(blog){ %>
<div>
<h2><%= blog.title %></h2>
<image src="<%= blog.image %>">
<span><%= blog.created %></span>
<p><%= blog.body %></p>
</div>
<% }) %>
<%= include partials/footer %>
The error that came on the browser :
SyntaxError: missing ) after argument list in /home/ubuntu/workspace/RESTful/RESTfulBlogApp/views/index.ejs while compiling ejs
How I fixed it : I removed "=" in the include statements at the top and the bottom and it worked fine.
How to reproduce this error:
SyntaxError: missing ) after argument list
This code produces the error:
<html>
<body>
<script type="text/javascript" src="jquery-2.1.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
}
</script>
</body>
</html>
If you run this and look at the error output in firebug, you get this error. The empty function passed into 'ready' is not closed. Fix it like this:
<html>
<body>
<script type="text/javascript" src="jquery-2.1.0.min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
}); //<-- notice the right parenthesis and semicolon
</script>
</body>
</html>
And then the Javascript is interpreted correctly.