SyntaxError: missing brackets after argument list [closed] - javascript

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 7 years ago.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Improve this question
Get this JavaScript error, and I don't get well where exactly to add the brackets
Uncaught SyntaxError: missing ) after argument list
function showContacts(){
console.log('Showing Contacts...');
setTimeout("$('#pageContent').load('contacts.php',functions(){$('loaderImage').hide();})",1000);
}

Typo: function should be used instead of functions(Notice extra s at the end)
function showContacts() {
console.log('Showing Contacts...');
setTimeout("$('#pageContent').load('contacts.php',function(){$('loaderImage').hide();})", 1000);
}

Related

pass php json_encode to jQuery function [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 5 years ago.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Improve this question
I would like to pass a php array to a jQuery function but I get this error:
SyntaxError: Unexpected token ')'. Expected either a closing ']' or a ',' following an array element.
my code:
function showDetails(data) {
alert(data);
}
<a onclick="showDetails(<? echo json_encode($arr['data']['items']); ?>)">
Click here
</a>
Use single quotes for the onclick attribute due to json double quotes which will cause html to break
<a onclick='showDetails(<? echo json_encode($arr['data']['items']); ?>)'>

Syntax Error jQuery [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
there is a syntax I can't figure out.
$(this).append(free);
And here is the error message in the console:
Uncaught SyntaxError: Unexpected token <
I have no idea, what this error message wants to tell me, because it makes no sense to me.
Simple, you are missing quotes:
$(this).append('free');
From the docs the parameter you pass can be:
"DOM element, array of elements, HTML string, or jQuery object to insert at the end of each element in the set of matched elements."
$(this).append('free');

Unexpected token ) <=== [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I am hooking up flexslider into a custom Wordpress theme but running into an issue within my JS which is strange.
jQuery(document).ready(function)($) {
$('.flexslider').flexslider();
});
It is telling me there is an unexpected token of ) but I can't see the offending part of script?
You've mixed up your parentheses:
jQuery(document).ready(function)($) {
$('.flexslider').flexslider();
});
should be:
jQuery(document).ready(function($) {
$('.flexslider').flexslider();
});

Unexpected Token Error with jQuery "{" [closed]

Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 8 years ago.
Improve this question
I am getting an unexpected token error when in my console when I run the page. Can anyone help point out where this is coming from? I believe I'm going blind because I can't see it.
define('QuoteSetupPageController', 'jquery' {
this.init = function() {
$(document).click(function(){
$('.header-message-indicator').hide();
});
}
});
Error is on line 1.
Thank you.
It should be:
define('QuoteSetupPageController', 'jquery', {
You were missing a comma.

SyntaxError: Invalid regular expression: missing / [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Closed 8 years ago.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
This question appears to be off-topic because it lacks sufficient information to diagnose the problem. Describe your problem in more detail or include a minimal example in the question itself.
Improve this question
According to http://www.regexr.com/38o5d my reqex seems to work, but when I implement it into my javascript
var prefix = hash.replace(/\/|#/g, '');
I'll get the following error: SyntaxError: Invalid regular expression: missing /
Psychic debugging: Your code isn't in a plain JavaScript or HTML file, but is being printed from a scripting language in which # is a comment character. The #/g, ''); piece is being treated as a comment in your script.
You need to add some quotes to ensure that the whole line gets printed.

Categories

Resources