开发者

error : invalid label when i try to get json from url SENCHA TOUCH

I try with the following code and i get error: invalid label

Ext.util.JSONP.request({
            url: 'http://demo.webfactory.mk/',
            callba开发者_如何学CckKey: 'callback',
            params: {
                action: 'retrieve',

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

            }

    });


You can also use Ajax request instead of JSONP, below is the code sample. This works for me.

Note that you cannot make cross domain Ajax calls, in chrome so u cant test in chrome. You need to deploy your Sencha script to the same Web server you are accessing. But All mobile browser supports this cross domain Ajax calls.

Go ahead and implement the same.

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);
        }
    });
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜