Merhaba ,
Sitemize interaktif yapabilemek "Disqus" Yorum sistemini adapte ettim. Şimdi ise yorum gelince yazarı uyaran bir sistem yapmaya çalışıyorum fakat token mistmatch hatası alıyorum.
Hata Ajax ve csrf token ile alakalı ama henüz çözemedim.
Filter.php de
Route::filter('csrf_header', function()
{
if (Session::token() != Request::header('x-csrf-token'))
{
throw new Illuminate\Session\TokenMismatchException;
}
});
Route::filter('csrf', function()
{
if (Session::token() != Input::get('_token'))
{
throw new Illuminate\Session\TokenMismatchException;//line 126
}
});
view-post.blade.php
<meta name="token" content="{{ Session::token() }}">
<script type="text/javascript">
var disqus_config = function() {
this.callbacks.onNewComment = [function(comment) {
$.ajax({
url: '/sendnotification',
csrf_token= Session::token(),
type: 'POST',
data: { comment: comment.id, post: "{{$post->id}}",author:"$post->author->id"},
dataType: 'JSON',
beforeSend: function(request) {
return request.setRequestHeader("X-CSRF-Token", $("meta[name='token']").attr('content'));
},
success: function(ev) {
},
error: function(xhr, error, status) {
}
});
}];
};
</script>
Bu hatayı nasıl aşabilirim ?