2014-07-15 82 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

相关问题