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)
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!
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.
You're missing a parentheses because you didn't quote your strings
myFunction('162.223.8.210', '25567', '#factionsOnline');
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With