2
I am having problems in recovering the data sent by my ajax to the laravel
.
Man ajax
is like this:
var id = $(this).siblings(':hidden').val(),
qtd = $(this).val(),
dataUser = { "id": id, "qtd": qtd};
$.ajax({
type: 'POST',
data: {'rel':dataUser},
url: window.location.href + "/atualiza",
success: function (e) {
alert(e);
}
});
And in my controller
is like this:
public function atualizaQtd(){
$arr = json_decode($_POST['rel'], true);
return $arr;
}
And so my route:
Route::post('/carrinho/atualiza', [
'uses' => 'CartController@atualizaQtd',
'as' => 'carrinho.atualiza'
]);
I need to access the data from id
and qtd
It was in my controller
to perform an activity.
How do I do this ? I tried to receive using the method Requests
and I also couldn’t.
By doing no error, just returns nothing.
Not picking up the request I have to put the function where ?
– Renan Rodrigues
It is worth remembering that what moved this is the event of changing a field to Qtd, the idea is that whenever change the amount it goes to the bank and changes
– Renan Rodrigues
@Renanrodrigues to change it needs to be called, do not have this information in your question!
– novic
@Renanrodrigues in your question you did not put also what you are doing, the answer is already a solution on what posted!!!
– novic