开发者

Consuming an OData request in Sencha Touch with JSONP

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

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜