2

我尝试使用以下代码,但出现错误:标签无效

Ext.util.JSONP.request({
            url: 'http://demo.webfactory.mk/',
            callbackKey: 'callback',
            params: {
                action: 'retrieve',

            },
            callback: function(data) {
                console.log('Inside data');
                var dataarray = data.result;
                console.log(dataarray);

            }

    });
4

1 回答 1

1

您也可以使用 Ajax 请求而不是 JSONP,下面是代码示例。这对我有用。

请注意,您不能在 chrome 中进行跨域 Ajax 调用,因此您无法在 chrome 中进行测试。您需要将 Sencha 脚本部署到您正在访问的同一 Web 服务器。但所有移动浏览器都支持这种跨域 Ajax 调用。

继续执行相同的操作。

Ext.Ajax.request({
        url: reqUrl,
        defaultHeaders : 'application/json',
        success : function(response, opt) {
            dataarray = Ext.decode(response.responseText);
            //App.views.viewport.reveal('nextScreen');
        },
        failure : function(response, opt) {
            Ext.Msg.alert('Failed', response.responseText);
        }
    });
于 2011-12-09T13:55:23.990 回答