SyntaxError: identifier starts immediately after numeric literal in Firebug

后端 未结 2 948
-上瘾入骨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:04

    The resulting JavaScript code will be

    kickUser(userName)
    

    …and obviously there is no js variable userName. You want to pass a string instead:

    kickUser('userName');
    

    So add the quotes/apostrophes to the output, and don't forget to escape the $rowUsers['userName'] properly. It's quite the same for $rowUsers['id_user'], which seems to have output even an invalid identifier.

提交回复
热议问题