I want to send multi step form data to a controller method when i click the save button and later request that data in the controller method using Jquery. I have tried some steps but even the button doesn't seem to do anything.
I have this route to store treatment data.
Route::post('/patients/{patient}/medications','PatientMedicationsController@store')->name('saveTreatment')->middleware('auth');
Some of the fields are
heartRate, bloodPressure, otherFindings, duration
And id of the submit button is save. i have this Jquery code in my blade view.
<script>
$(document).ready( function() {
$('#save').click( function () {
$.ajax({
url:("route('saveTreatment')"),
type: 'POST',
data: {'submit': true},
success: function () {
alert('Treatment has been saved');
}
});
});
});
</script>
The controller method to store is store.
I want the multi step form data to be received by the controller method and then saved to the database.
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire