samedi 8 février 2020

Laravel select dropdown using ajax

I have data in an array that contains hotels' names with their id. I want to place them in my select where I will display only the city an grab the id to do ajax and display rooms name. The problem is it is displaying both the name of the hotel and the id array in my dropdown. this is my controller.

 foreach ($hotel as $nam ){
   $hotel_nam[]=$nam->id;
   $hotel_nam[]=$nam->hotel_name;             
  }
  return  $hotel_nam;

this is my drop down

  {!! Form::select('hotel_name',$hotel_nam,'S', array('style'=>' Border:none; ', 'id' => 'hotel_id', 'onchange'=>"showRooms(this.value)"));!!}


from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2OEzWLc
via IFTTT

Aucun commentaire:

Enregistrer un commentaire