我应该能够加载相关的 XML 文件并在视频播放时显示 XML 文件的内容。
我错过了什么?
脚本
var XML_PATH = "http://www.adjustyourset.tv/interview/cuepoints.xml";
var cuepoints=new Array();
$(document).ready(function() {
loadXML();
});
function loadXML()
{
$.ajax({
type: "GET",
url: XML_PATH,
dataType: "xml",
success: function onXMLloaded(xml)
{
// set cuepoints
cuepoints=$(xml).find("cuepoints");
// loop for each cuepoint
$(xml).find('cuepoint').each(function loopingItems(value)
{
// create an object
var obj={
timeStamp:$(this).find("timeStamp").text(),
desc:$(this).find("desc").text(),
thumbLink:$(this).find("thumbLink").text(),
price:$(this).find("price").text()};
cuepoints.push(obj);
$("#mycustomscroll").append('<ul>');
$("#mycustomscroll").append('<li id="item"><strong>'+(value+1)+"</strong><br/><strong>Time Stamp: </strong>"+obj.timeStamp+'</li>');
});
// close </ul>
$("#mycustomscroll").append('</ul>');
// append li tags
$("#leftcolumn").append('<li src="'+cuepoints[0].desc+'"> <p src="'+cuepoints[0].thumbLink+'" /></li>');
$("#price").append(cuepoints[0].price);
}
});
}