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:'<% = 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) {