Some code please. I usually use get for that, a post / put I am updating data, i.e.,
public function petUpdate(Request $request)
{
if (!ChkAuth::chklog('user')) { // use your RBAC logic
abort(403);
}
$request->validate([
'species' => 'required'
]);
$petid = $request->input('petid');
$species = $request->input('species');
$postdata = [
'species' => $species
];
DB::table('dc_pets')
->where('petid', $petid)
->update($postdata);
return Response::json(['success' => 'all okay']);
}
Where return Response::json(['success' => 'all okay']); is displayed in a hidden DIV. For a quick example, it's not hidden.
success: function (data) {
var message = "data updated";
alertWithoutNotice(message);
$('#msg').append('<div>' + data.success + '</div>');
},
error: function (data, ajaxOptions, thrownError) {
if (data.status === 422) {
$.each(data.responseJSON.errors, function (key, value) {
$('#msg').append('<div>' + value + '</div>');
});
}
if (status === 403 || status === 500) {
$('#msg').text("Not Auth");
}
//window.location.href = '<?//= DIR . "indexbl" ?>';
}
msg is a div with that id. It was just a quick example I did a while back.
Also after success or fail (error), have a means to return to edit page. Or if success redirect in JS.
Many options ways to do this stuff.