Uncaught SyntaxError: Unexpected token :

sunil

Uncaught SyntaxError: Unexpected token : at url: I am trying to call controller 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();
                }
                });


        });

});

Alireza

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. Replace that code with something appropriate (a variable or a constant string literal) and it will work

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related