SyntaxError: identifier starts immediately after numeric literal in Firebug

后端 未结 2 957
-上瘾入骨i
-上瘾入骨i 2020-12-11 20:33

I\'m getting that error when I call this javascript function:

function kickUser(id_userChat){
$.post(\"chatFuncs.php\", { action: \"kick\", id_user: id_userC         


        
2条回答
  •  余生分开走
    2020-12-11 21:11

    Identifiers in JavaScript can't begin with a number; they must begin with a letter, $ or _.


    I'm guessing it's coming from this:

    onclick="kick_user('.$rowUsers['id_user'].')">Kick
    

    If you mean to pass a string, then you need to quote the value being passed.

    onclick="kick_user(\"'.$rowUsers['id_user'].'\")">Kick
    

    I don't know PHP, so maybe you need different escaping, but this should give you the idea.

提交回复
热议问题