嗨,大家好,請你告訴我如何訪問audioCollection對象內的內容?jQuery訪問對象值
我使用Echonest jQuery插件使用jQuery模板
https://github.com/Rodeoclash/Echonest-jQuery-Plugin/blob/master/scripts/echonest.js
我去螢火蟲和類型化console.log(audioCollection)
和我得到ReferenceError: audioCollection is not defined
。不知道我是否做得對。
echonest.artist(artist).audio(function(audioCollection) {
$('#blog-page').find('.post').append(audioCollection.to_html('<p class="song-url" style="display:none;">${url}</p>'));
//appends url variable to html inside of audioCollection
var testing = audioCollection; //returns [Object object]
});
謝謝!
你究竟在哪裏放了'console.log(audioCollection)'? – 2011-02-28 21:19:05
你在使用一些插件嗎?如果是,哪一個? 'audio'不是標準的jQuery函數。你必須提供更多信息。 – 2011-02-28 21:19:31
'audioCollection'只存在於其封閉函數的範圍內。這就是爲什麼你無法使用Firebug從全球範圍獲得它的價值。 – 2011-02-28 21:22:19