调用此函数时出现标题错误。
<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>
错误正在发生:
user = <?php echo $user; ?>;
但它让我在回声中获得了正确的价值。为什么会这样?