0

我正在尝试使用 jsonp 加载 ext 数据存储。当我使用 ajax 并在同一个域上发出请求时,下面的代码工作正常。

店铺定义:

var baseUrl = 'http://localhost:8090/'; 

Ext.define('Ktimatologio.store.NewWholeBlockStore', {
    extend: 'Ext.data.Store',
    alias: 'widget.newsingleblockstore',

    requires: ['Ktimatologio.model.NewWholeBlockModel'],

    model: 'Ktimatologio.model.NewWholeBlockModel',

    groupField: 'search_tag',

    fields: [   
        {name:'id', mapping:'id'},
        {name:'id1', mapping:'id1'},
        {name: 'text', mapping: 'text'},
        {name: 'title', mapping: 'title'},
        {name: 'fek', mapping: 'fek'},
        {name: 'date', mapping: 'date'},
        {name: 'descr', mapping: 'description'},
        {name: 'model', mapping: 'model'},
        {name: 'body', mapping: 'body'},
        {name: 'type', mapping: 'type'},
        {name: 'history', mapping: 'history'},
        {name: 'src', mapping: 'url'},
        {name: 'search_tag', mapping: 'search_tag'},
        {name: 'new_element', mapping: 'new_element'},
        {name: 'new_table', mapping: 'new_table'}
        ],

    autoLoad: true, 

    proxy: {
        //type:'ajax',
        type:'jsonp',
        url: baseUrl + 'openbd/ktimatologio-final/resources/cfScripts/nea_stoixeia/GetNewTables.cfc?',
        extraParams: {
            method: 'getNewTables'
            },
        reader:{
            type: 'json',
            root: 'data'
        }
    } 

当我运行代码时,我在 firebug 上看到一个错误:

SyntaxError: invalid label
{"data":[{"id":"1_n_2308_1995","id1":1,"title":"Άρθρο 1&nbspΦΕΚ Α΄ 114&nbsp15.6....

GetNew...llback2 (line 1, column 1)

我被困住了!

任何帮助深表感谢!

汤姆

希腊

4

1 回答 1

0

JSONP 服务实际上必须返回一个函数调用,而不仅仅是返回 JSON。谷歌一些例子。

于 2012-08-19T04:42:14.823 回答