我有一個函數,將獲得與對象的JSON數組。在函數中,我將能夠遍歷數組,訪問一個屬性並使用該屬性。就像這樣:使用JSON數組與對象與JavaScript
變量,我將傳遞給函數看起來就像這樣:
[{"id":28,"Title":"Sweden"}, {"id":56,"Title":"USA"}, {"id":89,"Title":"England"}]
function test(myJSON)
{
// maybe parse my the JSON variable?
// and then I want to loop through it and access my IDs and my titles
}
任何建議,我怎麼能解決呢?
的問題不明確。提供更準確和描述性的代碼。 – 2010-05-09 21:39:50