I'm implementing a voting system. I'm trying to implement AJAX in laravel 4 but I've had a 500 Internal Server Problem. The AJAX code was OK for create user system.

My form:

```
{{ Form::open(array('url' => 'profilepublicationvote', 'class' => 'vote_ajax')) }}
<input type="text" id="disabledTextInput" style="display:none" name="vote" value='1'>
<input type="text" id="disabledTextInput" style="display:none" name="user_id" value="{{ Auth::user()->id }}">
<input type="text" id="disabledTextInput" style="display:none" name="publication_id" value="{{ $publication->id }}">

{{ Form::submit('vote', array('class' => 'button expand round')) }}

{{ Form::close() }}

```

routes.php

```
Route::post('profilepublicationvote', function(){
if(Request::ajax()){
    $votedata = array(
        'vote'          =>  Input::get('vote'),
        'user_id'       =>  Input::get('user_id'),
        'publication_id'=>  Input::get('publication_id'),
    );
        $vote = new Profilepublicationvote($votedata);
        $vote->save(); 
        if($user)
        {
            return Response::json(array(
                'success'         =>     true,
                'message'         =>     'Yeah!'
            ));
        }
}
});

```

My javascript:

```
 $(document).ready(function() {
var form = $('.vote_ajax');
    form.bind('submit',function () {
        $.ajax({
            type: form.attr('method'),
            url: form.attr('action'),
            data: form.serialize(),
            complete: function(data){
            },
            success: function (data) {
                $('.success_message').hide().html('');
                    $(form)[0].reset();
                    $('.success_message').show().html(data.message)
            },
        });
   return false;
});
});

```

edit1: I've change $user for $vote but it's not the problem.