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. 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); 
    }); 

});

Answers


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; ?>;

Need Your Help

Problems with jquery form validation : not working for one or two empty input fields

javascript php jquery forms validation

I have seven input fields in a form and am using the jQuery validation plugin for validating each field. Validation is working fine if all input fields are empty. But its not working if one or two ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.