Answered by:
Parse Youtube Playlist in Windows 8 Metro App

Question
-
Hello,
I tried parsing a Youtube Playlist in windows 8 Metro app using $.getJSON() but it did not work.but it worked perfectly in other browsers.What am i doing Wrong
Here is the code i tried
function start() { var videoURL = 'http://www.youtube.com/watch?v='; $.getJSON(playListURL, function (data) { alert('Done'); $.each(data.feed.entry, function (i, item) { var title = item.title.$t; var feedURL = item.link[1].href; var fragments = feedURL.split("/"); var videoID = fragments[fragments.length - 2]; var url = videoURL + videoID; var hot = item.media$credit; var thumb = "http://i.ytimg.com/vi/" + videoID + "/hqdefault.jpg"; $('#title').text(title); $('#desc').attr('src', thumb); $('.red').attr('title', videoID); }); }); }
- Edited by Donnieibiyemi Monday, August 19, 2013 3:44 PM
Sunday, August 18, 2013 7:44 PM
Answers
-
Hi Donniebiyemi,
I don't think WinJS has the .getJSON() function, this is a function belong to JQuery.
By WinJS, you could do as following, the same as get JSON list.:
WinJS.xhr({url:'http://someservice.com'}).then( function(response) { var json = JSON.parse(response.responseText); }, function(error) { //handle error } );
Best Regards,
--James
<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.- Edited by Jamles HezModerator Thursday, August 22, 2013 9:32 AM ....
- Marked as answer by Jamles HezModerator Tuesday, August 27, 2013 9:33 AM
Thursday, August 22, 2013 9:31 AMModerator
All replies
-
More specifically, what's the problem?
http://endorsay.com
Monday, August 19, 2013 9:26 AM -
The problem is that the code i posted above works in a regular web browser but does not work in visual studio 2012.
I think its because am suppose to parse the Json response from the Youtube playlist with Winjs.xhr but sadly i don't know how to do all that because am new to developing for Windows 8. Please kindly help me parse the Response from the Youtube playlist using Winjs.xhr
- Edited by Donnieibiyemi Monday, August 19, 2013 3:36 PM
Monday, August 19, 2013 3:21 PM -
Hi Donniebiyemi,
I don't think WinJS has the .getJSON() function, this is a function belong to JQuery.
By WinJS, you could do as following, the same as get JSON list.:
WinJS.xhr({url:'http://someservice.com'}).then( function(response) { var json = JSON.parse(response.responseText); }, function(error) { //handle error } );
Best Regards,
--James
<THE CONTENT IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, WHETHER EXPRESS OR IMPLIED>
Thanks
MSDN Community Support
Please remember to "Mark as Answer" the responses that resolved your issue. It is a common way to recognize those who have helped you, and makes it easier for other visitors to find the resolution later.- Edited by Jamles HezModerator Thursday, August 22, 2013 9:32 AM ....
- Marked as answer by Jamles HezModerator Tuesday, August 27, 2013 9:33 AM
Thursday, August 22, 2013 9:31 AMModerator