Webservice返回undefined [英] Webservice returning undefined
本文介绍了Webservice返回undefined的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在下拉列表中未定义
< script type = text / javascript>
$( function (){
$ .ajax({
type: POST,
contentType: application / json; charset = utf-8,
url:' WebServices / AutoComplete.asmx / GetCountries',
数据: {},
数据类型: json,
成功:
function (data,event){
$ .map(data.d,功能(item){
// alert(item);
// $(#<%= drpCountry.ClientID%>)。index = item.countryid;
// $(#<%= drpCountry.ClientID%>)。val = item.countryname;
alert(item.countryname);
$( #<%= drpCountry.ClientID%>)。append( < option value = + item.countryid + > + item.countryname + < /选项> 中跨度>);
});
}
});
});
< / script>
解决方案
( function (){
.ajax({
type: POST,
contentType: application / json; charset = utf-8 ,
url:' WebServices / AutoComplete.asmx / GetCountries',
data: {},
datatype: json,
成功:
function (数据,事件){
.map(data.d, function (item){
// alert(item);
//
I got undefined in dropdown
<script type="text/javascript" >
$(function () {
$.ajax({
type: "POST",
contentType: "application/json; charset=utf-8",
url: 'WebServices/AutoComplete.asmx/GetCountries',
data: "{}",
datatype: "json",
success:
function (data, event) {
$.map(data.d, function (item) {
// alert(item);
// $("#<%= drpCountry.ClientID %>").index = item.countryid;
// $("#<%= drpCountry.ClientID %>").val = item.countryname;
alert(item.countryname);
$("#<%= drpCountry.ClientID %>").append("<option value="+item.countryid+" >"+item.countryname+"</option>");
});
}
});
});
</script>
解决方案
(function () {
.ajax({ type: "POST", contentType: "application/json; charset=utf-8", url: 'WebServices/AutoComplete.asmx/GetCountries', data: "{}", datatype: "json", success: function (data, event) {
.map(data.d, function (item) { // alert(item); //
这篇关于Webservice返回undefined的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文