how to do a despedency dropdown with add rows

how to do a despedency dropdown with add rows

the data taken from the automatic condition dropdown appears based on the selected activity, such as in the activity selecting the hose then a condition that appears based on activity hose, well the problem is if I want to add the form to fill in the data above.

help me:

my code:
$( document) . ready( function() {
$( ' select[name="activity[]"] ') . on( ' change ', function() {
var kode_detail_activity = $( this) . val();
if( kode_detail_activity) {
$ . ajax({
url: ' {{ url("penjualan_apar/get_kondisi") }}/ ' + kode_detail_activity,
type: " GET ",
dataType: " json ",
success: function( data) {
$( ' select[name="kondisi[]"] ') . empty();
$ . each( data, function( key, value) {
$( ' select[name="kondisi[]"] ') . append( ' <option value=" ' + key + ' "> ' + value + ' </option> ');
console . log( key);
});
}
});
} else{
$( ' select[name="kondisi[]"] ') . empty();
}
});
});

my view :
< thead >
< tr >
< th > Barcode </ th >
< th > Checklist Activity </ th >
< th > Kondisi </ th >
< th > Harga </ th >
< th >< button type = " button " name = " button " id = " addMore " onclick = " add() " class = " btn btn-success " > < span class = " fa fa-plus " ></ span ></ button ></ th >
</ tr >
</ thead >
< tbody id = " record_add " >
< tr >
< td >
< select name = " barcode[] " required id = "" class = " form-control " >
< option value = "" >----- Please Select -----</ option >
</ select >
</ td >
< td >
< select name = " activity[] " id = " activity " required class = " form-control " >
< option value = "" > Please Select </ option >
@foreach ($checklist as $ck)
< option value = " {{ $ck ->kode_detail_activity }} " >{{ $ck ->nama_detail_activity }} </ option >
@endforeach
</ select >
</ td >
< td >
< select name = " kondisi[] " id = "" required class = " form-control " >
< option value = "" >----- Please Select -----</ option >
</ select >
</ td >
< td >
< input type = " number " class = " form-control " name = " harga[] " placeholder = " 0 " >
</ td >
</ tr >
</ tbody >