jQuery— Populate select from json

前端 未结 8 1573
花落未央
花落未央 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条回答
  •  -上瘾入骨i
    2020-12-08 02:21

    I just used the javascript console in Chrome to do this. I replaced some of your stuff with placeholders.

    var temp= ['one', 'two', 'three']; //'${temp}';
    //alert(options);
    var $select = $(''); //$('#down');                        
    $select.find('option').remove();                          
    $.each(temp, function(key, value) {              
        $('

提交回复
热议问题