In one of my Laravel Application, I have a list of users along with approve and reject button (with each user record).
Now What I want to do is: performing those approve and reject action through jQuery rather than form submitting. But I can't figure out how to use jQuery AJAX along with all required data to the desired URL and receive a response from that URL to perform further action.
So my question is: How can I use jQuery AJAX in Laravel Application to send data from the front-end and catch those record from the backend (I hope Requests $request can catch those info) and also receive a response from the backend to process further action in the front-end?
TIA
I commonly use the following way in CodeIgnitor, but I can't figure out how to use a similar way in Laravel:
$.ajax({
url: 'url goes here',
data: {
'<?php echo $this->security->get_csrf_token_name(); ?>': csrf_token,
'id' : $.trim( $('#target_id').val() ),
'status' : $.trim( $('#extra_column').val() )
},
type: 'POST',
success: function (r) {
//action of success
},
error: function (e) {
console.log(e);
}
});
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire