jquery数据不绑定到下拉列表 [英] jquery data not binding to dropdown

查看:65
本文介绍了jquery数据不绑定到下拉列表的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述





我无法通过jquery json绑定绑定下拉列表。但在检查浏览器时,我可以看到数据。但不限于下拉列表。请帮帮我。







-------------- -------------------------------------------------- ---------

检查代码:





I am not able to bind the dropdownlist by jquery json binding. But while inspecting browser i can see the data. But not binding to dropdown. Please help me.



-------------------------------------------------------------------------
inspect code :

d: [,…]
0: {__type: "dropdown.WebService1+CountryDetails", CountryId: "211249", CountryName: " New Bolt & Tools"}
CountryId: "211249"
CountryName: " New Bolt & Tools"
__type: "dropdown.WebService1+CountryDetails"







------------------- -------------------------------------------------- ----------



i需要国家名称绑定

------------------------- ----------






-------------------------------------------------------------------------------

i need the countryname to bind
-----------------------------------

<script type="text/javascript">
    $(document).ready(function () {
        $.ajax({
            type: "POST",
            contentType: "application/json; charset=utf-8",
            url: "WebService1.asmx/BindDatatoDropdown",
            data: JSON.stringify({ bCode: '<%=branchCode %>', stcon: '<%=strCon %>' }),
            dataType: "json",
            success: function (data) {
                $.each(data.d, function (key, value) {
                    $("#ddlCountryx").append($("<option></option>").val(value.CountryId).html(value.CountryName));
                });
            },
            error: function (result) {
                alert("Error");
            }
            });
    });
</script>







----------------- ----------




---------------------------

推荐答案

(document).ready(function(){
(document).ready(function () {


.ajax ({
类型:POST,
contentType:application / json; charset = utf-8,
url:WebService1.asmx / BindDatatoDropdown,
数据: JSON.stringify({bCode:'<% = branchCode %> ',stcon:'< span class =code-pagedirective><% = strCon %> '}),
dataType:json,
成功:函数(数据){
.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: "WebService1.asmx/BindDatatoDropdown", data: JSON.stringify({ bCode: '<%=branchCode %>', stcon: '<%=strCon %>' }), dataType: "json", success: function (data) {


.each(data.d,function(key,value){
.each(data.d, function (key, value) {


这篇关于jquery数据不绑定到下拉列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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