简体   繁体   English

未捕获到的SyntaxError:意外令牌:

[英]Uncaught SyntaxError: Unexpected token :

Uncaught SyntaxError: Unexpected token : at url: I am trying to call controller insert/getdata 未捕获的SyntaxError:意外的令牌:在url:我正在尝试调用控制器insert / getdata

<script>
$(window).load(function(){
    // do something 
$(document).ready(function () {

                //d=   <?php echo $userid; ?>
                $.ajax({   
                    url:"http://localhost/CodeIgniter/index.php/insert/getdata", //The url where the server req would we 
                    async: false,
                    type: "POST", //The type which you want to use: GET/POST
                   data: {activeNodeID : <?php echo $userid; ?>}, //The variables which are going.

                    //This is the function which will be called if ajax call is successful.
                    success: function(response){

                    $("#ques").html(response);
                    $("#ques").show();
                }
                });


        });

}); });

That line is fine. 那条线很好。 I think the error is being raised because of this line: 我认为由于此行而引发错误:

<?php echo @userid; ?>

This code should be placed inside a PHP server script, but found its way to the browser which does not understand it. 这段代码应该放在PHP服务器脚本中,但是发现了无法理解的方式。 Replace that code with something appropriate (a variable or a constant string literal) and it will work 用适当的内容(变量或常量字符串文字)替换该代码,它将起作用

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM