i want to show when update data in multiple select via jquery to laravel
my Controller
$get_user->region = $region; $get_user->nama_customer = customer_name($get_user->kode_customer); $ispector = array(); $get_inspector = DB::table('tabel_inspector') ->where('kode_user',$id) ->first(); if(isset($get_inspector)){ $all = explode(',',$get_inspector->list_customer); foreach($all as $a){ $inspector[] = $a; } $get_user->list_inspector = $inspector; } return response()->json($get_user);
My Jquery, in jquery i'm using in_array, but not working
$('#role').val(data.id_level); if(data.list_inspector == undefined || data.list_inspector == null){ $('#inspector').hide(); }else{ var a = jQuery.inArray(data.list_inspector); $('#role').val(a); }