When you see thisArticleI believe you also know why cross-origin access is required! I will not talk about it here. In sencha touch 2, cross-origin access can be implemented using ext class library to provide our class Ext. data. jsonp. If you want to submit a request, you can use the request () method as follows:
When submitting a request, you can write it like this
1 Ext. Data. jsonp. Request ({
2 URL: 'http: // api.xxx.com ',
3 Params :{
4 // PASS Parameters
5 },
6 Timeout: 30000,// Timeout
7 Callbackkey :'', // The callback function name. The default value is callback.
8 Callback: Function (){
9 // The callback function is executed no matter whether the request is successful or not.
10 },
11 Success: Function (Result ){
12 // Run catch when the request is successful.
13 },
14 Failure: Function (){
15 // Perform the operation when the request fails.
16 }
17 });