简体   繁体   English

SyntaxError:missing; 在使用AJAX声明之前

[英]SyntaxError: missing ; before statement with AJAX

I came across this error while doing an ajax request and after looking over if I simply can't find the problem. 我在做一个ajax请求时遇到了这个错误,看了之后我是否根本找不到问题。 Here is the code below. 这是下面的代码。

$('#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); 
    }); 

});

I think you meant to use the equals sign? 我想你的意思是使用等号?

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

instead of 代替

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

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM