There are a problems requesting JSON object from GDATA using jQuery. jQuery appends a timestamp to the url which causes GData to throw an "Invalid parameter" error. If you check with FireBug, you'll see it.
Also, GData's API says to use "alt=json-in-script" instead of just "alt=json". It's hard to find, and I made the same mistake at first. Without a callback parameter in the query, GData will return the object wrapped in "gdata.io.handleScriptLoaded({...})" but jQuery seems to want to try callback-less JSON requests as XHRs. I ended up working around these problems by manually inserting the script and building a dummy gdata.id object to catch the result. It's clumsy but it works and will be easy to convert once jQuery and GData start to get along better. gdataURL = http://gdata.youtube.com/feeds/api/videos?format=1&vq=cat&start-index=10&max-results=20&orderby=viewCount&alt=json-in-script // insert the script: var s = document.createElement('script'); s.src = gdataURL; document.getElementsByTagName('head')[0].appendChild(s); //fake object: gdata = { io: { handleScriptLoaded: function(data) { JSONparser(data); } } }; I've posted to this list about this and opened an issue with Google: http://code.google.com/p/gdata-issues/issues/detail?id=390 Hope this helps, joe On Mar 7, 3:36 am, Saidur <[EMAIL PROTECTED]> wrote: > Hi , > I want to get the json data from the youtube api (http:// > code.google.com/apis/youtube/developers_guide_protocol.html). > > My code is like : > url="http://gdata.youtube.com/feeds/api/videos?format=1&vq=cat&start- > index=10&max-results=20&orderby=viewCount&alt=json"; > > $.getJSON(url,callBackFucntion); > > function callBackFucntion () > { > // here parse the json data > > } > > But i got an error when i run this code. > [Exception... "'Permission denied to call method XMLHttpRequest.open' > when calling method: [nsIDOMEventListener::handleEvent]" nsresult: > "0x8057001e (NS_ERROR_XPC_JS_THREW_STRING)" location: "<unknown>" > data: no] > > so agian i change the url and add the callback parameter with ? : > url="http://gdata.youtube.com/feeds/api/videos?format=1&vq=cat&start- > index=10&max-results=20&orderby=viewCount&alt=json&callback=?"; > $.getJSON(url,fucntion (data){ // parse json data > alert ('json data get'); > > }); > > This time i do not get error . But i do not get the call back > > So how can i get the json data problem > > Thanks > Saidur Rahman