I am having trouble propagating a selct2 dropdown from data from an API. I am using this example from here
https://select2.org/data-sources/ajax
as well as from here
Basically, my select2 dropdown is showing, but it is empty.
Here is my select 2 HTML code
<select class="form-control" name="shortcode" id="formControlSelectShortCode" required>
Here is my script
$('#formControlSelectShortCode').select2({
ajax: {
url: 'https://api.github.com/search/repositories',
dataType: 'json'
}
});
I used the 2 pages above as a reference, but the code looks ok from what i can see. it might be an issue with the api, however, the sample on the page works fine.