jQuery— Populate select from json

前端 未结 8 1584
花落未央
花落未央 2020-12-08 01:56

I have a map in my java sevlet and converting it to a json format that works right.

When I do this function below it creates a drop down, but it puts every character

8条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-08 02:29

    That work fine in Ajax call back to update select from JSON object

    function UpdateList() {
        var lsUrl = '@Url.Action("Action", "Controller")';
    
        $.get(lsUrl, function (opdata) {
    
            $.each(opdata, function (key, value) {
                $('#myselect').append('');
            });
        });
    }
    

提交回复
热议问题