Laravel 4.2和AJAX POST – 500内部服务器错误

我对以下问题感到困惑:

我有一个看起来像这样的代码

@if( $user_message_block ) id }}"> @else @endif user->username }}">
{{ Form::token() }}
jQuery(document).ready(function($){ $('#form-user-send-message').on('submit', function(){ // ajax post method $.post( $(this).prop('action'),{ "_token": $( this ).find( 'input[name=_token]' ).val(), "msg-id": $( '#msg-id' ).val(), "getter": $( '#getter' ).val(), "user-message": $( '#user-message' ).val() }, function(data){ $(".message-area").append('
' + data['who'] + ' said:
' +'
' + data['when'] + '
' +'
' + data['seen'] + '
' +'
' +'
' + data['text'] + '
'); $('.message-area').scrollTop($('.message-area')[0].scrollHeight); $('#user-message').val(''); }, 'json' ); return false; }); });

当我删除这部分代码

 @if( $user_message_block ) id }}"> @else  @endif 

我用它替换它

 id }}"> 

一切正常。

是否有一些关于If-else条件会影响AJAX产生500错误。 HTML呈现正确,

有人可能会为我解开这个问题。

谢谢!

这是我的网络错误预览

 error: {type:Symfony\Component\Debug\Exception\FatalErrorException,…} file: "F:\bol\app\controllers\ProfileController.php" line: 384 message: "Call to a member function count() on a non-object" type: "Symfony\Component\Debug\Exception\FatalErrorException" 

转到调试工具 – >网络 – >单击红色500内部服务器错误,然后使用“预览”(如果在chrome上)编辑OP。