hi guys im new anyone can help me
i cant save my input data in my database
i use ajax like this
$(document).ready(function(){
$("#btn").click(function(){
var name= $('#editor').val();
$.ajax({
type: 'post',
url: "{{ route('sendcom') }}",
data:{ name: name },
headers: {
'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')
},
} );
});
});
and i try use ckeditor5 so i have sendcom route and this is my box and button:
<form action="{{ url('sendcom') }}" method="post">
@csrf
<textarea class="form-control" id="editor" name="editor"></textarea>
<input type="submit" id="btn" name="submit" value="Submit" />
</form>
and i try to get my data in my controller like this
public function sendcom(Request $request){
$content = $request->name;
User::updateOrCreate([
'contract' => $content
]);
return response(['success' => 'contract save success.']);
}
but its just refreshing my box and nothing hapend