1
我打電話給一些JSON(縮小尺寸原因);jquery json中的嵌套對象
"numExecutors" : 2,
"description" : null,
"jobs" : [
{
"name" : "Test",
"url" : "http://www.carlbruiners.com/job/Test/",
"color" : "blue"
},
{
"name" : "Test 2",
"url" : "http://www.carlbruiners.com/job/Test%202/",
"color" : "blue"
}
]
我需要能夠在jobs.name字段,但我試過各種循環,但我不能讓它工作。我的jquery代碼是;
function getJobs() {
$.jsonp({
"url": jenkins_url + "/api/json?jsonp=jsoncallback=?",
"data": {
"alt": "json-in-script"
},
"success": function(data) {
//alert('Sucess');
for(var key in data) {
var value = data[key];
//alert(value);
}
},
"error": function(e) {
alert('Failed ' + e);
}
});
}