我使用jQuery.ajax返回JSon对象。我首先阅读了其他文章,但它们的响应文本与我的不同。 我的响应内容:来自Firebug响应。
{"item":"[{\"country\":\"USA\",\"lan\":\"EN\"},{\"country\":\"Turkiye\",\"lan\":\"TR\"}]"}
现在我正在尝试弹出国家名称:
$('#loadData').click(function() {
$.ajax({
type: "POST",
url: "WS/myWS.asmx/getDaa",
data: "{}",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function(msg) {
$("#jsonResponse").html(msg);
$.each(msg.item, function(i, d) {
alert(this.country);
debugger;
});
},
});
});
但是它会弹出警告信息"undefined"