如何使用JASON填充下拉列表 [英] How to populate the dropdown list with JASON

查看:73
本文介绍了如何使用JASON填充下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

<script type="text/javascript">
    $("#ReportId").change(function () {
        $.ajax({
            url: "/RLMaster/GetHeadName",
            data: { ReportId: $('#ReportId').val() },
            type: "GET",
            dataType: "json",
            success: function (data, textStatus) {
                alert(data);
                loadData(data);
            },
            error: function () {
                alert("Failed! Please try again.");
            }
        });
    });
</script>





这是我的Javascript。我能够从数据库中检索数据但无法使用该数据填充我的DropDown列表。

请帮忙。还告诉我我应该为下拉列表写的HTML



This is my Javascript. I am able to retrieve data from database but unable to populate my DropDown List with that data.
Please help. Also tell me the HTML which I should write for the dropdown

推荐答案

#ReportId)。change( function (){
("#ReportId").change(function () {


.ajax({
url: / RLMaster / GetHeadName
data:{ReportId:
.ajax({ url: "/RLMaster/GetHeadName", data: { ReportId:


' #ReportId')。val()},
类型: GET
dataType: json
成功: function (数据, textStatus){
alert(data);
loadData(data);
},
error: function () {
alert( 失败!请再试一次。);
}
});
});
< / script>
('#ReportId').val() }, type: "GET", dataType: "json", success: function (data, textStatus) { alert(data); loadData(data); }, error: function () { alert("Failed! Please try again."); } }); }); </script>





这是我的Javascript。我能够从数据库中检索数据但无法使用该数据填充我的DropDown列表。

请帮忙。还告诉我我应该为下拉列表编写的HTML



This is my Javascript. I am able to retrieve data from database but unable to populate my DropDown List with that data.
Please help. Also tell me the HTML which I should write for the dropdown


这篇关于如何使用JASON填充下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆