Reputation: 591
here i tried the code . but it is not working . please help me
<script type="text/javascript" language="javascript">
$(document).ready(function(){
$("#dvContent").append("<ul></ul>");
$.ajax({
type: "GET",
url: "http://gdata.youtube.com/feeds/api/playlists/cZxy-GpHLCQ_Ss9sGJfWhzBAIOMDYxMN?v=2",
dataType: "xml",
success: function(xml){
$(xml).find('feed').each(function(i){
var sTitle = $(this).find('title');
// alert(sTitle);
for (var i = 0; i < sTitle.length; i++) {
var ssTitle = sTitle[i].firstChild.nodeValue;
$(ssTitle).appendTo("#dvContent ul");
}
});
},
error: function() {
alert("An error occurred while processing XML file.");
}
});
});
</script>
Demo Link :- http://jsfiddle.net/8HUbc/
Thanx in Advance !!
Upvotes: 0
Views: 103
Reputation: 6059
After the line:
var sTitle = $(this).find('title');
Just do:
sTitle.text();
And you'll have it.
Upvotes: 1
Reputation: 193261
Try narrow the search with feed
children nodes only:
var title = $(xml).find('feed > title').text();
Upvotes: 0
Reputation: 7898
Your ajax request is failing (this has nothing to do with processing your XML file). The error callback is not like a try/catch
block around your success function, it is an indication that either the server returned something other than a 200 or so response code or there was no response from the server at all.
Upvotes: 0