var params = {
body_text: event.editor.getData(),
_token: <?php echo csrf_token(); ?>
};
Jun 19, 2015
10
Level 1
TokenMismatchException Ajax Help
I'm trying to have ckeditor inline functioning but i'm running into a problem. This is the ckeditor editable content
<div id="{!! $user->name !!}-editable" class="about"
@if(auth()->check())
@if (auth()->user()->id == $user->id)
contenteditable="true"
@endif
@endif
>
{!! $user->about_me !!}
</div>
this is the ajax to handle the edits:
CKEDITOR.disableAutoInline = true;
CKEDITOR.inline( '{!! $user->name !!}-editable', {
on: {
blur: function( event ) {
var params = {
body_text: event.editor.getData()
};
jQuery.ajax({
url: '/users/{!! $user->name !!}',
global: false,
type: "PUT",
dataType: "text json",
data: params,
success: function(result) {
console.log(result);
}
});
}
}
});
What do i need to put in the ajax or the div for it to work?
Level 48
var params = {
body_text: event.editor.getData(),
_token: '<?php echo csrf_token(); ?>'
};
And it is not taken from the DOM :)
Please or to participate in this conversation.