Javascript error; Uncaught SyntaxError: missing ) after argument list

◇◆丶佛笑我妖孽 提交于 2019-12-30 17:25:24

问题


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)

回答1:


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

myFunction('162.223.8.210', '25567', '#factionsOnline');


来源:https://stackoverflow.com/questions/30853666/javascript-error-uncaught-syntaxerror-missing-after-argument-list

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!