Reputation: 190
I try with the following code and i get error: invalid label
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);
}
});
Upvotes: 2
Views: 556
Reputation: 5941
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);
}
});
Upvotes: 1