Im getting the tittle error when im calling this function.
<script type="text/javascript">
function upvote(user, id){
fazer = <?php echo $doornot ?>;
if( fazer == 'true'){
window.location = "http://www.dawnsource.com/forums/register.php";
}else {
user = <?php echo $user; ?>;
id = <?php echo $_GET[id]; ?>;
$.ajax({
url: 'scripts/upvote.php',
type: 'post',
data: 'user='+user+'&id='+id,
success: function()
{
alert('success, upvote completed ');
}, error: function()
{
alert('something went wrong, rating failed');
}
});
}
}
</script>
The error is going on:
user = <?php echo $user; ?>;
But its getting me the right value in the echo. Why is this happening?
user = "<?php echo $user; ?>";. note that quotes around php tags