2012-09-08 73 views
0

我遇到这个错误,同时做一个Ajax请求,并在看后,如果我根本无法找到问题。这是下面的代码。SyntaxError:missing;之前与AJAX声明

$('#post_submit').click(function() { 

var poster_id = <?php echo $session_user_id; ?>; 
//firebug syntax error shows the line below is the problem 
var profile_user_id: <?php echo $user_id; ?>; 
var post = $('#post').val(); 
$.post('ajax_submit_post.php', 
    { 
     profile_user_id: profile_user_id, 
     poster_id: poster_id, 
     comment_type : comment_type, 
     post: post  
    }, 
    function() { 
     $('#status').append('<li class="hide">Posted</li>').hide(1000); 
    }); 

}); 

回答

2

我想你打算使用等号?

var profile_user_id = <?php echo $user_id; ?>; 

,而不是

var profile_user_id: <?php echo $user_id; ?>; 
+0

是啊,我发现它的权利,当通知我,你一个答案回答。当它让我时,我会给你支票。 – jason328

相关问题