data.Store с другого сервера
Добрый день!
Есть работающий Store :
var store = new Ext.data.Store({
url : 'http://mysite.ru/index.php',
remoteSort: true,
reader: new Ext.data.JsonReader({
root:'rows',
totalProperty: 'total',
id:'tid'
}, tid,DeliveryType_id,Transaction_id)
});
Если заменить в url на адрес удаленного сервера, то перестает работать. Есть ли решение проблемы? |
var store = new Ext.data.JsonStore({
root: 'topics',
totalProperty: 'totalCount',
idProperty: 'threadid',
remoteSort: true,
fields: [
'title', 'forumtitle', 'forumid', 'author',
{name: 'replycount', type: 'int'},
{name: 'lastpost', mapping: 'lastpost', type: 'date', dateFormat: 'timestamp'},
'lastposter', 'excerpt'
],
// load using script tags for cross domain, if the data in on the same domain as
// this page, an HttpProxy would be better
proxy: new Ext.data.ScriptTagProxy({
url: 'http://extjs.com/forum/topics-browse-remote.php'
})
});
|
Спасибо. Долго бился с проблемой - выдавала ошибка invalid label.
Оказалось что ответ нужно отдавать не в голом JSON, а так: if (isset($_REQUEST['callback'])) { header('Content-Type: text/javascript'); echo $_REQUEST['callback']. '(' . $jsonData . ');'; } else { header('Content-Type: application/x-json'); echo $jsonData; } Т.е. ScriptTagProxy добавляет к адресу параметр callback, который необходимо вывести. Подробней здесь: http://www.sencha.com/forum/archive/...p/t-22990.html |
| Часовой пояс GMT +3, время: 21:25. |