specify fares, js to dynamically change fare form; get applicable fares for the flight/pirep #125
This commit is contained in:
28
resources/views/layouts/default/pireps/scripts.blade.php
Normal file
28
resources/views/layouts/default/pireps/scripts.blade.php
Normal file
@@ -0,0 +1,28 @@
|
||||
@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({
|
||||
url: "{!! url('/pireps/fares') !!}?aircraft_id=" + aircraft_id,
|
||||
type: 'GET',
|
||||
headers: {
|
||||
'x-api-key': '{!! Auth::user()->api_key !!}'
|
||||
},
|
||||
success: (data) => {
|
||||
console.log('returned new fares', data);
|
||||
destContainer.html(data);
|
||||
},
|
||||
error: () => {
|
||||
destContainer.html('');
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user