O
O
Oleg Seledets2019-08-09 09:57:34
JavaScript
Oleg Seledets, 2019-08-09 09:57:34

How to pass value to onchange action?

There are two combobox fields (form-control):

First KB
<select class="form-control" id="soft_type" name="soft_type" required="required" onchange="changeCombo1()">												
  @foreach($result_types as $rtype)
    <option>{!! $rtype->type !!}</option>
  @endforeach
</select>

Second KB
<select class="form-control" id="soft_name" name="soft_name" required="required">														
  @foreach($result_names as $rname)
    <option>{!! $rname->name !!}</option>
  @endforeach
</select>

A route has been defined that fetches results from the database and transfers them back to the KB
route
Route::get('/', function () {
  $result_types = DB::select('SELECT type FROM equip_cost GROUP BY type');
  $result_names = DB::select('SELECT name FROM equip_cost GROUP BY name'); // where type="'.$data_type['soft_type'].'"');
  $data = array('description' => ' Главная страница',
                  	'title' => ' Главная страница',
                  	'result_types' => $result_types,
      'result_names' => $result_names 
  );
  return view('index', $data);
});

How can I pass the current value of KB1 (when changing the value in it) to the request for KB2:
$result_names = DB::select('SELECT name FROM equip_cost GROUP BY name'); // where type="'.$data_type['soft_type'].'"');

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton Shamanov, 2019-08-09
@SilenceOfWinter

ajax call Laravel controller

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question