最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

jquery - Javascript error; Uncaught SyntaxError: missing ) after argument list - Stack Overflow

programmeradmin3浏览0评论

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('/'+ ip + ":" + port, function(data){
        console.log(data.online);
        $(div).html(data.online);
    });
}
myFunction(162.223.8.210, 25567, #factionsOnline)

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/api/'+ ip + ":" + port, function(data){
        console.log(data.online);
        $(div).html(data.online);
    });
}
myFunction(162.223.8.210, 25567, #factionsOnline)
Share Improve this question edited Mar 22, 2017 at 7:06 Pooja Kedar 4372 gold badges10 silver badges23 bronze badges asked Jun 15, 2015 at 19:42 devindevin 1131 gold badge1 silver badge6 bronze badges 0
Add a ment  | 

1 Answer 1

Reset to default 11

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

myFunction('162.223.8.210', '25567', '#factionsOnline');
发布评论

评论列表(0)

  1. 暂无评论