getJSON typerror e未定义 [英] getJSON typerror e is undefined
问题描述
我下面有这个jQuery
I have this jquery below
$.getJSON('../GetCities?', { term: inputString }, function (data) {
var anchorTagElements = '';
console.log("line 39 ");
$.each(data.items, function (i, item) {
console.log("line 41 " );
anchorTagElements = anchorTagElements + '<a href=""><span class="searchheading">' +
item.City + ', </span></a>';
});
我可以看到使用Firebug从服务器返回的数据我可以看到第39行已打印到日志中,但第41行并不意味着它在第41行console.log之前就失败了 我收到的错误消息是 TypeError:e未定义
i can see the data is coming back from the server using firebug i can see the line 39 is printed to the log but line 41 is not meaning it failed right before the line 41 console.log error msg i am getting is TypeError: e is undefined
![在此处输入图片描述] [1]
![enter image description here][1]
有什么想法可以看的?
编辑
使用jQuery不缩小我得到了 TypeError:obj未定义 长度= obj.length,
using jquery non minified i got TypeError: obj is undefined length = obj.length,
它无法尝试评估长度,我想我不确定为什么,我可以看到数据正确返回. 这是返回的数据
its failing trying to get the length to evaluate i i think not sure why, i can see the data coming back correctly. Here is the Data that comes back
推荐答案
$.each(data, function (i, item) {
anchorTagElements = anchorTagElements + '<a href=""><span class="searchheading">' +
item.City + ', </span></a>';
});
这篇关于getJSON typerror e未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!