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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3931
    Vote Rating
    1272
      0  

    Default

    JSONP proxy will only work with JSON
    Mitchell Simoens @LikelyMitch
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    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 - Sr Software Engineer mitchellsimoens's Avatar
    Join Date
    Mar 2007
    Location
    Gainesville, FL
    Posts
    39,556
    Answers
    3931
    Vote Rating
    1272
      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
    Sencha Inc, Senior Software Engineer
    ________________
    Learn BBCode and use it! Checkout the CODE tag!

    Check out my GitHub, lots of nice things for Ext JS and Sencha Touch
    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
  •