I am making a "editable table" without any javascript frameworks, just jQuery to load partial views (editable rows and read-only rows).
I would like, if possible, to use my default ValidationException handler for this. It simply does:
return redirect()
->back()
->withErrors($exception->validator->messages())
->withInput($request->all());
The problem is that the back() call returns not my latest requested editable row, but the entire page. I assume this is because AJAX-requests are not saved by Laravel as a "previous location", and thus not accessible via back(). Is there a way I can override this?
Edit to clarify question:
When the user clicks the "Edit"-button on a row the "editable row partial" is AJAX-requested and placed in document.
When the user AJAX-submits the editable row and a validation error happens I want the editable row partial to be returned again, this time with errors and old input. Just like a regular, non-AJAX failed form submission. This can be done manually by catching the exception and returning said view, but if possible I want to just use back() - and for that be possible I need the request from 1. to somehow be pushed into Laravels stack of "previous locations".