我想将ajax响应数据加载到下拉菜单中 [英] I want to load ajax response data into dropdown
本文介绍了我想将ajax响应数据加载到下拉菜单中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想将ajax响应数据加载到下拉列表中。我的页面上有一个下拉列表。我只想加载一个包含选项列表的ajax响应数据到下拉列表中。
I want to load ajax resonse data into dropdown list. I have one dropdown list on my page. I just want to load ajax response data which will contain list of options into dropdown list.
这是我的下拉列表。
<select title="Basic example" id="muliSelect6" class="multipleCheckbox" multiple="multiple" name="example-basic6[]" size="5">
</select>
我正在使用以下ajax脚本:
I am using the following ajax script :
$.ajax({
url: "GetPerPersonData.php",
type: "POST",
data: {
building: $('#muliSelect1').val(),wing:$('#muliSelect3').val()
},
success: function(data)
{
$("#muliSelect6").html('');
$("#muliSelect6").html(data);
}
});
我收到回复作为选项列表如下
I am getting the response as a list of options as following
<option value="yogesh">Yogesh kale</option>
但它没有在下拉列表中加载。所以请帮助我正确地输出输出。
But it does not get loaded in dropdown list. So please help me in getting the output correctly.
推荐答案
使用追加代替HTML
Use append instead of HTML
$('#multiSelect6').append(data);
这篇关于我想将ajax响应数据加载到下拉菜单中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文