2014-07-15 132 views
0

未捕獲的SyntaxError:意外的標記:在網址: 我試圖呼叫控制器插入/的GetData未捕獲的SyntaxError:意外的標記:

<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(); 
       } 
       }); 


     }); 

});

+0

這是你的PHP腳本的一部分嗎? – Alireza

+0

不,它是在視圖中,我正試圖加載腳本,因爲頁面加載 – sunil

回答

2

那條線很好。我認爲被提出的錯誤,因爲這行:

<?php echo @userid; ?> 

此代碼應放在一個PHP服務器腳本里面,但發現它的方式不理解它的瀏覽器。用適當的東西(一個變量或一個常量字符串文字)替換該代碼,它將起作用

+0

只是我評論該行,因爲我不想傳遞任何數據 – sunil

+0

發生了什麼? – Alireza

+0

嘿感謝它的工作 – sunil

相關問題