Reputation: 701
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();
}
});
});
});
Upvotes: 0
Views: 6590
Reputation: 5056
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
Upvotes: 2