PDA

View Full Version : Wordpress JSON API and data store



rudiboot
14 Feb 2011, 6:15 AM
Hi,

I'm trying to load some json data in a data store.
The data is generated by wordpress json api and is valid (http://www.slcyh.mobi/content/api/get_recent_posts/).

When I use the relative url to load the data (see code below), i get an empty response, I know the code is ok as if I store the response in the text file on the server, and use that for the url, I get the data through.

I can get the data when I use Ext.util.JSONP.request with the full url, so i thought it could be down the json api not liking being call from ajax relative path, so I tested that with jquery and got the data through.

Any clues would be welcome.
Thanks


Ext.regModel('Post2', {
fields: ['id','type','slug','url','status','title','title_plain','content','excerpt','date','modified','categories','tags','author','comments','attachments','comment_count','comment_status','_wp_geo_latitude','_wp_geo_longitude']
});

ListDemo.myStore2 = new Ext.data.Store({
model: 'Post2',
proxy: {
type: 'scripttag',
url : 'http://slcyh.mobi/content/api/get_category_index/',
reader: {
type: 'json',
root: 'posts'
}
},
autoLoad: true
});