2

嗨,我是 sencha touch2 的新手。我必须使用外部网络服务。我在控制台中编写了如下代码,它给出了这样的错误Uncaught TypeError: Cannot call method 'request' of undefined。什么问题,请提供解决方案。谢谢

Ext.util.JSONP.request({
    url: 'http://localhost/SLS.BRND.Services/Service1.asmx/Helloworld',
    params: {
        method: 'Helloworld',
        format: 'json',
        callback: 'callback'
    },

    success: function(response) {
        alert('Working!')
        console.log(response);
    },
    failure: function(response) {
        alert('Not working!')
        console.log(response);
    }
});​
4

3 回答 3

5

添加这个:

requires: ['Ext.data.JsonP'],
于 2012-08-03T22:44:24.787 回答
0

尝试使用Ext.data.jsonP.request

Ext.data.JsonP.request({
    url: 'http://localhost/SLS.BRND.Services/Service1.asmx/Helloworld',
    params: {
        method: 'Helloworld',
        format: 'json',
        callback: 'callback'
    },

    success: function(response) {
        alert('Working!')
        console.log(response);
    },
    failure: function(response) {
        alert('Not working!')
        console.log(response);
    }
});​

演示

希望这可以帮助

于 2012-05-09T04:46:13.170 回答
0

尝试 -

Ext.data.JsonP.request({
    url: 'http://A-Valid-Domain/SLS.BRND.Services/Service1.asmx/Helloworld',
    params: {
        method: 'Helloworld',
        format: 'json',
        callback: 'callback'
    },

    success: function(response) {
        alert('Working!')
        console.log(response);
    },
    failure: function(response) {
        alert('Not working!')
        console.log(response);
    }
});​
于 2013-06-09T06:37:49.803 回答