2018-02-25 05:38:25 +08:00
|
|
|
@section('scripts')
|
|
|
|
<script>
|
|
|
|
$(document).ready(() => {
|
|
|
|
const select_id = "select#aircraft_select";
|
|
|
|
const destContainer = $('#fares_container');
|
|
|
|
|
|
|
|
$(select_id).change((e) => {
|
|
|
|
const aircraft_id = $(select_id + " option:selected").val();
|
|
|
|
console.log('aircraft select change: ', aircraft_id);
|
|
|
|
|
|
|
|
$.ajax({
|
2018-03-13 06:58:12 +08:00
|
|
|
url: "{{ url('/pireps/fares') }}?aircraft_id=" + aircraft_id,
|
2018-02-25 05:38:25 +08:00
|
|
|
type: 'GET',
|
|
|
|
headers: {
|
2018-03-13 06:58:12 +08:00
|
|
|
'x-api-key': '{{ Auth::user()->api_key }}'
|
2018-02-25 05:38:25 +08:00
|
|
|
},
|
|
|
|
success: (data) => {
|
|
|
|
console.log('returned new fares', data);
|
|
|
|
destContainer.html(data);
|
|
|
|
},
|
|
|
|
error: () => {
|
|
|
|
destContainer.html('');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
</script>
|
|
|
|
@endsection
|