2👍
✅
Problem is solved. Since here the data received in ajax function for id_batch (or data) is of string type, thatswhy it is not showing any value in choiceField. By adding:
data = $.parseJSON(data);
after
success: function(data){
and removing this pointer form the key and value variable means
$('#id_batch').append('<option value="' + key + '">' + value +'</option>');
solved my problem. For detailed information, check out here.
Thanks
Source:stackexchange.com