Sencha touch 2 for cross-origin access

Source: Internet
Author: User

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 });

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.