I have to parse the json data from this url http://gdata.youtube.com/feeds/api/videos?q=aNdMiIAlK0g&max-results=1&v=2&alt=jsonc using jquery. I have to extract the media:title and description of the video.
Anyone know how do that?
I have to parse the json data from this url http://gdata.youtube.com/feeds/api/videos?q=aNdMiIAlK0g&max-results=1&v=2&alt=jsonc using jquery. I
Share
You’re probably looking for jQuery.getJSON(): http://api.jquery.com/jQuery.getJSON/
getJSONreturns a response with propertydata, anddatahas a property ofitemswhich is an array. The array only has one item, so we’re just usingitems[0], and that item has a propertytitleand a propertydescriptionthat we’re going to save into our variables.Hope this helps!
//edit: oops, yeah I thought response would be a better name for the variable, forgot to update the second line