Try this and post the output
dd($request->get('ids')) ;
Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.
Hello , i'm using an ajax post request to send an array ( selectedids) to the controller
$.ajax({
type:'POST',
url:'{{action('OrderController@ajaxRequestPost')}}',
data: { "type":strUser , "_token": "{{ csrf_token() }}","ids":JSON.stringify(selectedIds)},
dataType: 'json',
success:function(data){
alert(data);
},
error: function(xhr, textStatus, thrownError) {
alert(' Error');
}
});
but i cannot loop over it in the controller i tried json_decode but it didn't work
the only thing that worked is :
echo $request->get("ids");
it shows this : 14,21,12 how can i iterate over it to get all the ids
thank you
Please or to participate in this conversation.