I'm new to codiginiter and it's still developing.
I'm trying to send a JS value to codiginiter controller but I'm getting errors. Firebug says syntax error. But when I correct it, another syntax error is being shown.
I think the problem is with my script. Can anyone can figure out what's wrong? All I want is to send username value to method in controller. Following alert is triggered when I press the button (tested and working).
<script type="text/javascript">
$(function(){
$("#postAnswer").click(function(){ // passing down the event
alert("checked");
$.post('<?php echo base_url(); ?>homepage/postanswer', {
//username:document.getElementById('username').value
username:<?php $ques[0]->username ?>
});
});
});
</script>
Aucun commentaire:
Enregistrer un commentaire