ajax を使用する必要があります。最初の選択が変更されたら、選択した値を、リクエストを処理して結果をページに返すリモート python スクリプトに渡す必要があります。この時点で、javascript を介して 2 番目の選択を入力する必要があります。
データは単純な html または json 形式にすることができます。これは、jquery と ajax を使用した例です ( jQuery ライブラリを含めることを忘れないでください):
html:
<form action="" method="post">
<select class="changeStatus" name="changeStatus">
<option value="0">Car</option>
<option value="1">Motorcycle</option>
<option value="2">BUS</option>
</select>
</form>
JavaScript:
<script>
$('document').ready(function(){
// change event handler
$('select.changeStatus').change(function(){
// You can access the value of your select field using the .val() method
//alert('Select field value has changed to' + $('select.changeStatus').val());
// You can perform an ajax request using the .ajax() method
$.ajax({
type: 'GET',
url: 'your_script_python.py', // This is the url that will be requested
// select value available inside your_script_python.py
data: {selectFieldValue: $('select.changeStatus').val()},
// on success: populate your second select.
success: function(html){
alert('data passed: ' + html);
},
dataType: 'html' // or json
});
});
});
</script>