我正在使用以下功能从'PlayListJSON.aspx'加载歌曲的播放列表,但似乎有些错误,evrytime OnFailure被调用,我无法对其进行进一步调试。任何帮助都将是gr8。
Player.prototype.loadPlaylist = function(playlistId, play) {
req = new Ajax.Request('/PlaylistJSON.aspx?id=' + playlistId, {
method: 'GET',
onSuccess: function(transport, json) {
eval(transport.responseText);
player.setPlaylist(playlist.tracklist, playlist.title, playlistId);
player.firstTrack();
if (play) player.playSong();
},
onFailure: function() {
//error
}
});
}
通常,由于某些原因而无法到达您要调出的页面时,就会调用OnFailure。
您确定URL / PlaylistJSON.aspx是有效的吗?
您是否尝试过传递参数参数,而不是将其指定为url的一部分?
req = new Ajax.Request('/PlaylistJSON.aspx',
{
method: 'GET',
parameters: {
'id': playlistId
},
onSuccess: function(transport,json){
eval(transport.responseText);
player.setPlaylist(playlist.tracklist,playlist.title, playlistId);
player.firstTrack();
if (play)
player.playSong();
},
onFailure: function() {
//error
}
});
是页面PlayListJSon.aspx是在根目录中。