jquery - JavaScript - Read XML Document -
I have a YouTube video ID and I want to get the video title for this ID. I have received the XML feed that contains the title, but it is uncertain how to remove it.
$ Ajax ({url: 'http: // gdata .youtube.com / feeds / API / video /' + video ID). Done (function (data) {console.log (data.title); // console.log does not work (data.entry.title); / / does not work}); jQuery will not automatically convert JSON to XML for you. Just use jQuery to treat XML documents as DM trees.
$ (function () {$ .ajax ({url: 'http://gdata.youtube.com/feeds/api/(video/vnUwxDhE1kU', datatype: 'XML'} ) (Function) {console.log ('done', $ (data) .find ('entry'; title '). Text ());});});
Comments
Post a Comment