开发者

Consuming an OData request in Sencha Touch with JSONP

开发者 https://www.devze.com 2023-03-10 13:02 出处:网络
I\'m working on a Sencha Touch app and I want to use OData so I have been playing around with the netflix Odata service. When I send my reque开发者_如何学JAVAst with JSONP in Sencha I can see the requ

I'm working on a Sencha Touch app and I want to use OData so I have been playing around with the netflix Odata service. When I send my reque开发者_如何学JAVAst with JSONP in Sencha I can see the request come back when I trace it, however my callback function is never getting called. Can anyone help? Here is my code.

var blah = function () {
    Ext.util.JSONP.request({
        url: 'http://odata.netflix.com/catalog/Titles()',
        callbackKey: 'callback',
        params: {
            $format: 'json',
            $top: '10',
            $filter: "startswith(Name,'C')",
            $select: "ShortName"
        },
        callback: function (result) {
            alert('asdf');
            var data = result;
            if (data) {
                alert('data');
            } else {
                alert('There was an error during retrieving data.');
            }
        }
    });
}

var button = new Ext.Button({
    text: 'Ajax',
    listeners: {
        'tap': blah
    }
});

Thanks in advance


If you're getting a syntax error on the server response quotes, this is a known issue described here for which there is an available update.


The server is returning XML, not JSON data.

0

精彩评论

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