首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >JsonP scriptTag extjs4.1发行

JsonP scriptTag extjs4.1发行
EN

Stack Overflow用户
提问于 2012-08-18 20:18:34
回答 1查看 711关注 0票数 0

我得到了以下服务器响应:

回调({“数据”:{ "id":"13_gnomodotiseis“、"id1":13、”标题“:"5/2009ΓΝΜΔΕΙΣΑΠ2009”、“文本”:"5/2009ΓΝΜΔΕΙΣΑΠ“、”模型“:"gnomodotiseis”、"body":“σίλει.“类型”:“文本”、“历史”:“旧”、"url":"“、"search_tag":"Γνωμοδοτήσεις”、"new_element":"true“}、"dataset":1 })

我有这样的商店定义:

代码语言:javascript
复制
var baseUrl = 'http://localhost:8090/'; 

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

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

    model: 'Ktimatologio.model.NewSingleBlockModel',

    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/GetNews.cfc?',
        callbackKey: 'callback',
        extraParams: {
            method: 'jsonP'
            },
        reader:{
            type: 'json',
            root: 'data'
        }
    } 

});

我在firebug中看到的url:

tag"%2C"direction"%3A"ASC"}]&callback=Ext.data.JsonP.callback2

Firebug给了我错误:"ReferenceError:回调未定义“

我的问题是:

Ext.data.JsonP.callback2从哪里弹出的url?

我在这里错过了什么?Extjs4.1中的jsonP是如何工作的?

这件事我真的需要帮助。

提前谢谢你,

汤姆

希腊

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2012-08-20 18:05:28

您在响应中使用了错误的函数名。如果您查看请求url,可以看到它正在发送您的响应需要调用的函数名,并且需要在响应数据:&callback=Ext.data.JsonP.callback2中使用它,因此响应应该调用函数Ext.data.JsonP.callback2,而不是简单的回调。因此,在您的示例中,服务器应该将其作为响应返回:

代码语言:javascript
复制
Ext.data.JsonP.callback2({ "data": [ { "id": "13_gnomodotiseis", "id1": 13, "title": "5/2009 ΓΝΜΔ ΕΙΣΑΠ 2009", "text": "5/2009 ΓΝΜΔ ΕΙΣΑΠ ", "model": "gnomodotiseis", "body": "σίλει...", "type": "text", "history": "old", "url": "", "search_tag": "Γνωμοδοτήσεις", "new_element": "true" } ], "dataset": 1 })

这是因为callback=Ext.data.JsonP.callback2是在请求中发送的。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/12021947

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档