Here is an example to append options to a select tag from an API response
in jquery foreach
  $.each(response, function(index, option) {
    $('#select-tag').append('<option value="' + option + '">' + option + '</option>');
  });
});This can be also done by foreach on php but sometimes we may need js or jquery to append data upon some conditions.