im passing a array data
in my ajax
to controller and use the data to the queries
but when i already return the data it's blank when i alert
it but in my network
it have a data. Can someone help me about this?
routes:
Route::get('/member/page/press_release_email/view_send_email_press_release/sent_email', 'Member\Press_Release_Controller@pass_id');
ajax:
$.ajax({
type: "GET",
url: "/member/page/press_release_email/view_send_email_press_release/sent_email",
data: {ids:myArr},
dataType:"json",
success: function(data){
alert(data)
}
});
controller:
public function pass_id(Request $req)
{
$emails = Tbl_press_release_recipient::select('research_email_address')->whereIn('recipient_id', Request::input('ids'))->get();
return json_encode($emails);
}
You are trying to select research_email_address
with their recipient_id
but your ids are currently strings (As seen in your network's tab screenshot.)
You need to fill myArr
with the recipient_id
data.