mardi 24 novembre 2015

Pass value javascript on laravel route

i try to pass 'sat' value from route. My problem in this line.

 $return_array[] = array('value' => $v, 'id' =>$k, 'sat' => $k);

i can pass 'value' and 'id', but im confusing on 'sat'

'sat' => ??;

here is my route code

{
$term = Input::get('term');
$data = DB::table('sps')
            ->select(array('sps.namasp', 'kodesp', 'sat'))
            ->where('namasp','like','%'.$term.'%')
            ->lists('namasp','kodesp','sat');

$return_array = array();

foreach ($data as $k => $v) {
    if (strpos($v, $term) !== FALSE) {
        $return_array[] = array('value' => $v, 'id' =>$k, 'sat' => $k);
    }
}
return Response::json($return_array);
});



via Chebli Mohamed

Aucun commentaire:

Enregistrer un commentaire