Results 1 to 4 of 4

Thread: Error - "xml can't be the whole program" while making cross-domain call to fetch xml

  1. #1
    Sencha User
    Join Date
    May 2012
    Posts
    2
    Vote Rating
    0
      0  

    Default Error - "xml can't be the whole program" while making cross-domain call to fetch xml

    I am new to extjs and using it to make a cross-domain call. This call returns xml. This is my code

    <!DOCTYPE HTML>
    <html>
    <head>
    <title>EXTJS Getting Started: MyApp</title>
    <link rel="stylesheet" type="text/css" href="/extjs/resources/css/ext-all.css">
    <script type="text/javascript" src="/extjs/ext-all.js"></script>
    <script>
    Ext.define('QUERY_RESULTS', {
    extend: 'Ext.data.Model',
    fields: ['CONTENT']
    });
    var store = new Ext.data.Store({
    model: 'QUERY_RESULTS',
    proxy: {
    type: 'jsonp',
    url : 'http://sonewebsite.com/index?page=xmlfeed&channel=ALERTS&max=4&view=abc' ,
    reader : {
    type : 'xml',
    record: 'QUERY_RESULT'
    }
    }
    });
    store.load();
    alert(store);
    </script>
    </head>
    <body> </body>
    </html>
    It is giving me error as "xml can't be the whole program". I have checked through firebug, the response I am getting is correct, but the line " alert(store) " is not returning the desired response, instead its returning "[Object] [object]". How I can correct this issue ?

  2. #2
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,062
    Answers
    3976
    Vote Rating
    1391
      0  

    Default

    JSONP proxy will only work with JSON
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

  3. #3
    Sencha User
    Join Date
    May 2012
    Posts
    2
    Vote Rating
    0
      0  

    Default

    I am also having the option for taking json as a feed in my code with the following changes-

    url : 'http://sonewebsite.com/index?page=jsonContent&channel=ALERTS&max=4&view=abc' ,
    type : 'json',

    But, still its giving me the same issue !

  4. #4
    Sencha User mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    40,062
    Answers
    3976
    Vote Rating
    1391
      0  

    Default

    There is no json proxy. To do cross origin calls you either have to use JSONP proxy (which you must use JSON not XML) or enable CORS and use the ajax proxy
    Mitchell Simoens @LikelyMitch
    Modus Create, Senior Frontend Engineer
    ________________
    Need any sort of Ext JS help? Modus Create is here to help!

    Check out my GitHub:
    https://github.com/mitchellsimoens

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •