Hi,
Im having problem with load data from json file placed on other server.
Here's my code:
PHP Code:
Ext.define('Tasty.store.Categories',
{ extend: 'Ext.data.Store',
requires:['Ext.data.proxy.JsonP'],
config: {
model:'Tasty.model.Categories',
autoLoad: true,
proxy:{
type:'scripttag',
url:'http://www.upmenu.pl/api/v1/menu/productGroups/7/9/f42286f7-df2d-11e1-a35c-00163edcb8a0',
reader:{
type:'json',
},
callbackKey:'callback',
}
}});
model:
PHP Code:
Ext.define('Tasty.model.Categories', {
extend: 'Ext.data.Model',
config: {
fields: [
{name: 'name', type: 'auto'},
{name: 'id', type: 'auto'},
{name: 'desription', type: 'string'},
{name: 'iconUrl', type: 'auto'},
{name: 'imageUrl', type: 'auto'},
{name: 'types', type: 'auto'},
{name: 'products', type: 'auto'} ]
}});
and response from server:
PHP Code:
[{"id":"2d99a361-df39-11e1-a35c-00163edcb8a0","name":"Pizza","description":"do wszystkich pizzy na wynos dodajemy sosy: pomidorowy i czosnkowy","types":[],"iconUrl":null,"imageUrl":null,"products":[]},{"id":"dcb21ee4-df98-11e1-a35c-00163edcb8a0","name":"Dodatki do pizzy","description":"","types":[],"iconUrl":null,"imageUrl":null,"products":[]},{"id":"c410851d-df96-11e1-a35c-00163edcb8a0","name":"Dania obiadowe","description":"wszystkie zestawy serwowane z kompotem dnia","types":[],"iconUrl":null,"imageUrl":null,"products":[]},{"id":"6a32f65e-df99-11e1-a35c-00163edcb8a0","name":"Dodatki obiadowe","description":"","types":[],"iconUrl":null,"imageUrl":null,"products":[]},{"id":"6ee1bb73-df98-11e1-a35c-00163edcb8a0","name":"Napoje","description":"","types":[],"iconUrl":null,"imageUrl":null,"products":[]}]
and when i changed proxy type to ajax and read json from local file it loaded it properly...
Anyone knows solution?