Answer the question
In order to leave comments, you need to log in
Ajax gives an error The Response content must be a string or object implementing __toString(), "boolean" given?
I can not figure out how to save to the database with ajax. Everything seems to be fine, but for some reason this error comes out. The Response content must be a string or object implementing __toString(), "boolean" given. and I don't understand what to do with it, my implementation is in the
controller
public function store(Request $request)
{
Execute::created($request);
return true;
}
Route::get('/execute/create', '[email protected]');
Route::post('/execute/create', '[email protected]');
$('.form-create-execute').on('submit', function (e) {
e.preventDefault();
let form = $(this).serialize();
console.log(form);
$.post({
data: form,
url: 'http://localhost:8000/execute/create',
}).done((res) => {
console.log(typeof res);
console.log(res)
})
.fail(error => console.log(error.responseJSON.message))
})
Answer the question
In order to leave comments, you need to log in
Who and where said that the controller method in Laravel can return a boolean value? The error directly states this.
I repeat once again - you need to carefully read error messages, documentation, google and think, and not write questions on the toaster in any sneeze. You can't become a normal programmer like that...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question