samedi 6 mai 2017

AJAX Post request in laravel 5.4

Have anyone got issue in ajax post request in laravel 5.4. I am unable to get request data in controller. Ajax request is something like this:

$.ajax({
     data: { 'selected_data':[2,4,5] },
     type: "POST",
     url: "",
     headers: {'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')},
     success: function (res) {
         console.log(res)
     },
});

In controller method, i am just doing

dd($request->all());

But getting empty array. can anyone help me with this issue? Thanks!



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire