javascript – Cannot choose from select option-ThrowExceptions

Exception or error:

I have a combo box or select option in HTML and I am getting the values of the option from AJAX.
Now the values are loaded, but the problem is that it does not give me the ability to choose between them. It just sticks with the first option.
I am using HTML5 and JavaScript.
Select option with loaded values by $.get()

This is the Jquery code:

$.get("api/categories/", function (category) {
        var select = document.getElementById("cat_name");
        for (var i = 0; i < category.length; i++) {
            var option = document.createElement('option');
            option.value = `${category[i].id}`;
            option.innerHTML= `${category[i].name}`;
How to solve:

Leave a Reply

Your email address will not be published. Required fields are marked *