Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
573 views
in Technique[技术] by (71.8m points)

jquery - 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)
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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

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

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...