I am trying to access a remote json file using YUI, example code can be seen in the jsfiddle below. The request goes off to the server (you can see it in Google dev tools network tab)
. The on success or failure functions don’t get executed which I can’t understand
http://jsfiddle.net/brendan_rice/4FZc4/3/
Can anyone help please?
Your datasource must support the callback syntax, wrapping the data with callback([…]);
Read the first section (in blue) http://yuilibrary.com/yui/docs/datasource/datasource-get.html
I figured out the issue by putting in YUI({ filter: ‘debug’ }), which showed that there was a syntax error in the .Get request (which is indicative of sending over unwrapped JSON data).
Also, if you just want the raw data from a cross-origin request and don’t need a real DataSource instance, you may find Y.jsonp easier to use (http://yuilibrary.com/yui/docs/jsonp/).