我有一個數組和ajax函數。我將這些對象添加到數組中。jquery每個json對象什麼都不做
var names = [];
...
success: function(msg){
for (var i in msg.response.pipelines){
for (var j in msg.response.pipelines[i].statuses){
names.push({
pipeline: msg.response.pipelines[i].name,
item: msg.response.pipelines[i].statuses[j].name
});
}
}
然後我在控制檯中看到console.log(names)
然後我試圖讓 「項」 和陣列的 「管道」。
console.log(names.length); // give 0
$.each(names, function (key) {
console.log('123');
console.log(key.item + ' - ' + key.pipeline);
})
但我發現了什麼,就好像函數不存在...
使用是有控制檯的任何錯誤或後123未定義或幹啥什麼? –
你可以發佈'JSON',而不僅僅是圖像? – Ionut
我不知道你是否試圖在請求執行之前處理'names'。 – Utkanos