PDA

View Full Version : json p store problem



cain@spiral.co.nz
9 May 2012, 4:51 PM
if I use this twitter feed I have a working json p store
http://api.twitter.com/1/statuses/us...&include_rts=1 (http://api.twitter.com/1/statuses/user_timeline.json?screen_name=microsoft&include_rts=1)

If I save the json to a file and try use this it wont work
http://nzrabwcfservice.nzrab.org.nz/tweet.json

wilzdezign
10 May 2012, 8:38 AM
You need to wrap it in a callback function (more info on Ext.data.proxy.JsonP (http://docs.sencha.com/touch/2-0/api/Ext.data.proxy.JsonP))

With the twitter API, if you add &callback=callback to the URL address, you will see the JSON get wrapped by callback( );

If you have your local JSON, you will need to provide a URL parameter that will then insert a function and wrap your JSON. For example, //nzrabwcfservice.nzrab.org.nz/tweet.json?callback=function123 should then return:

function123(
[ { "created_at": "Wed May 09 19:21:23 +0000 2012",
.......
},
{ ...}
]
);

cain@spiral.co.nz
10 May 2012, 9:45 PM
Thanks man that's just what I needed. I gave up on the static files had another look at configuring the output of my WCF servie and got it working.