我正在使用jquery,我的代码有问题.
这是我的代码
.done(function (result) {
var data = [];
result.each(function (index) {
var obj = {};
obj.label = result[index].Campaign;
if (result[index].Count == 0) {
obj.data = 0;
} else {
obj.data = result[index].SL / result[index].Count;
}
data.push(obj);
})
.....
.....
})
Run Code Online (Sandbox Code Playgroud)
我Uncaught TypeError: undefined is not a function上了这个each功能
告诉我为什么?
"result"参数中的值不是jQuery对象,并且没有"each"属性.因此,result.each是undefined,并且您正在尝试将其用作函数.
你可能想要$.each():
$.each(result, function(index, value) { ... });
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
5238 次 |
| 最近记录: |