loadPlaylist: function (playlistURL)
{
// request
new Ajax.Request(playlistURL, {
method: 'get',
onSuccess: this.onLoad.bindAsEventListener(this),
onFailure: this.loadFailure.bindAsEventListener(this),
onException: this.loadFailure.bindAsEventListener(this)
});
}
onLoad: function (request)
{
var ajaxResponse = request.responseXML;
...
// you can examine the response using the DOM
}
var args = '<?xml version="1.0" encoding="utf-8"?> ' +
'<submission>' +
' <u>' + BLUid + '</u>' +
'<track>' +
' <name>' + trackName + '</name>' +
' <artist>' + artistName + '</artist>' +
' <album>' + this.album + '</album>' +
'</track>' +
'</submission>';
// request the file
new Ajax.Request(BossaPlayer.updateURL, {
method: 'post',
contentType: 'application/xml',
encoding: '',
postBody: args,
onSuccess: this.onProfileUpdated.bindAsEventListener(this),
onFailure: this.profileUpdateFailure.bindAsEventListener(this),
onException: this.profileUpdateFailure.bindAsEventListener(this)
});
Great post thanks! You are right, the prototype documentation is spotty at the best. This is a welcome addition.
Posted by: Andy at June 16, 2008 09:31 AM