Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Javascript error; Uncaught SyntaxError: missing ) after argument list

I keep getting this error (Javascript error; Uncaught SyntaxError: missing ) after argument list) when trying to call a simple function. Everything works without calling it in a function but I need to do it multiple times.

function myFunction(ip, port, div) {
    $.get('http://mcping.net/api/'+ ip + ":" + port, function(data){
        console.log(data.online);
        $(div).html(data.online);
    });
}
myFunction(162.223.8.210, 25567, #factionsOnline)
like image 945
devin Avatar asked Jun 15 '15 19:06

devin


People also ask

How do you fix uncaught SyntaxError missing after argument list?

The "SyntaxError: missing ) after argument list" occurs when we make a syntax error when calling a function, e.g. forget to separate its arguments with a comma. To solve the error make sure to correct any syntax errors in the arguments list of the function invocation. Copied!

What is uncaught SyntaxError missing after argument list?

The JavaScript exception "missing ) after argument list" occurs when there is an error with how a function is called. This might be a typo, a missing operator, or an unescaped string.


1 Answers

You're missing a parentheses because you didn't quote your strings

myFunction('162.223.8.210', '25567', '#factionsOnline');
like image 186
adeneo Avatar answered Oct 12 '22 04:10

adeneo