Created
August 22, 2020 16:28
-
-
Save underhilllabs/0d2669174401bd6aba619d9933750d60 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
document.addEventListener('turbolinks:load', () => { | |
$('.dynamic-fy').on("change", function () { | |
var fy_id = $(this).children("option:selected").val() | |
$.getJSON("/dynamic_select/" + fy_id + "/projects.json?request_type=supplemental_request", function( data ) { | |
$('.dynamic-project').empty(); | |
$('.dynamic-report').empty(); | |
$('.dynamic-project').append($('<option>', {value: 0, text: "-- select project --"})); | |
$.each(data, function(key, val) { | |
$('.dynamic-project').append($('<option>', {value: val["id"], text: val["current_title"]})); | |
}); | |
}); | |
}); | |
$('.dynamic-project').on("change", function () { | |
var proj_id = $(this).children("option:selected").val() | |
$.getJSON("/dynamic_select/" + proj_id + "/requests.json", function( data ) { | |
$('.dynamic-report').empty(); | |
$('.dynamic-report').append($('<option>', {value: 0, text: "-- select request --"})); | |
$.each(data, function(key, val) { | |
$('.dynamic-report').append($('<option>', {value: val["id"], text: val["name"]})); | |
}); | |
}); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment