簡體   English   中英

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

[英]Uncaught SyntaxError: Unexpected token :

未捕獲的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();
                }
                });


        });

});

那條線很好。 我認為由於此行而引發錯誤:

<?php echo @userid; ?>

這段代碼應該放在PHP服務器腳本中,但是發現了無法理解的方式。 用適當的內容(變量或常量字符串文字)替換該代碼,它將起作用

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM