I'm making an AJAX call, so after the call I need to return some data, but I can't see any data. What's the workaround?
Here's AJAX call:
$('#addDishForm').submit(function(e) {
e.preventDefault();
var el = $(this);
var fromValues = el.serialize();
$.post('/admin/menu', fromValues, function(data) {
console.log(data);
});
});
Here's a route:
Route::middleware('auth')->prefix('/admin')->namespace('Admin')->group(function () {
// other routes ...
Route::post('/menu', 'MenuController@store');
// other routes ...
});
And here's a MenuController
and its store()
method
public function store(Request $request)
{
return response()->json($request->all());
}
My form is big, so I inlude a part of it:
{!! Form::open([ 'url' => '/menu', 'method' => 'POST', 'files' => 'true', 'id' => 'addDishForm' ]) !!}
<div class="modal-body">
<div class="form-group">
</div>
</div>
{!! Form::close() !!}
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire