0

Update:

Hi, I do not think my question is same as the mentioned question, there are 2 reasons:

  1. that question is asking about how to overcome the CORS problem and we all know that from a website, you cannot retrieve data from another website(B) which has different domain unless B has specifically configured its website to allow other to access its data. But in my case, the Cordova/SenCha Touch generated app doesn't have the http protocol when requesting, so it's not the same problem.

  2. I want to know how to do the ajax call in SenCha Touch, but don't know where to put in the ajax call code; but in that post/question developers can put that ajax call code in anywhere which is not my case.

Please reconsider your request about closing down my question.

Thank you


I need to retrieve data which is in xml format from a remote server. The data is opened to the public, so no restrictions.

Here is my code :

Ext.define('myApp.store.configStore', {
    extend: 'Ext.data.Store',
    requires: 'myApp.model.Config',
    autoLoad: true,
    storeId: 'ConfigStore',
    proxy: {
        type: 'ajax',
        url: 'http://webtrak.bksv.com/mel/configuration',
        reader: {
            type: 'xml',
            record: 'airport',
            rootProperty: 'config'
        }
    }
});

But I am not able to get anything.

I cannot test it in browsers as the reason:

> "No 'Access-Control-Allow-Origin' header is present on the requested
> resource. Origin 'http://localhost:1991' is therefore not allowed
> access."

But if I test it in mobile phone, then I cannot get any error messages. So which means basically it's really hard to debug the app, I have to reply on guessing all the time which is REALLY PAINFUL!!!!

Can someone post a code example for me? For your convenience, I found a fantastic place to test code:

SenCha Fiddle

I am looking forward to any advice and help.

Thanks in advance.

Franva
  • 5,410
  • 16
  • 62
  • 122
  • possible duplicate of [jQuery xml error ' No 'Access-Control-Allow-Origin' header is present on the requested resource.'](http://stackoverflow.com/questions/19821753/jquery-xml-error-no-access-control-allow-origin-header-is-present-on-the-req) – Molecular Man Apr 11 '14 at 08:35
  • @MolecularMan Hi Molecular thx to your reply. I'd like to find where I can put that code in my code. But I'm in SenCha and don't know how and where to add the Ajax call, so that's the problem. And also, I make a request call from the SenCha Touch app which is not same as making a call from a website. – Franva Apr 11 '14 at 09:12
  • @MolecularMan Hi, please take a look about my update. cheers – Franva Apr 11 '14 at 09:19
  • Oh, sorry. I understood. – Molecular Man Apr 11 '14 at 09:34
  • Here is a good [screencast about debugging Sencha Touch apps](https://www.youtube.com/watch?v=ikymrJu5BaA). It's not as painful as it might seem. – M165437 Apr 11 '14 at 11:47
  • @M165437 hi M16, really glad to see you here :) looking into the tutorial now. hopefully I can figure it out soon! – Franva Apr 11 '14 at 12:01
  • hi @M165437, it seems that the tutorial teaches us how to use Chrome to debug. But CORS issue cannot be solved in browsers so I have to test my code on devices. So that makes testing really painful – Franva Apr 11 '14 at 12:08
  • Hi @M165437 , I finally made it work. But what I did was put an Ajax call which fetches the data inside the controller and left store empty. It's not a proper way to do it. I still would like to know how to do the data fetch inside a store. I am grateful if you could help. thanks – Franva Apr 11 '14 at 15:38
  • possible duplicate of [Sencha touch XML response to JSON](http://stackoverflow.com/questions/8258813/sencha-touch-xml-response-to-json) – Paul Sweatte Dec 24 '14 at 07:25

0 Answers0