1. #1
    Sencha User
    Join Date
    Apr 2011
    Posts
    2
    Vote Rating
    0
    Racon is on a distinguished road

      0  

    Question Access-Control-Allow-Origin

    Access-Control-Allow-Origin


    XMLHttpRequest cannot load http://xyz. Origin http://localhost is not allowed by Access-Control-Allow-Origin.

    I get this Exception in my Chrome Browser.

    The server I run is Apache (XAMPP).

    How can I fix this? What can I do?

    Thank you very much

    My Source Code:

    <script type="text/javascript">

    new Ext.Application({

    name: 'Hello World',

    launch: function() {



    Ext.Ajax.request({

    url: 'http://xyz',

    method: 'GET',

    headers: {'Authorization': 'Basic GVU0IXZ6cFGzczE='},

    success: function(response, opts) {

    var obj = Ext.decode(response.responseText);

    console.dir(obj);

    },

    failure: function(response, opts) {

    console.log('server-side failure with status code ' + response.status);

    }

    });



    }

    });

    </script>

  2. #2
    Sencha User
    Join Date
    Nov 2010
    Location
    Norway
    Posts
    56
    Vote Rating
    1
    aCa is on a distinguished road

      0  

    Default


    Take a look as JSONP and ScriptTagProxy. Also read this wiki page: http://en.wikipedia.org/wiki/Same_origin_policy.

  3. #3
    Sencha User
    Join Date
    Aug 2010
    Location
    Europa
    Posts
    216
    Vote Rating
    1
    kortovos is on a distinguished road

      0  

    Default


    Or you can use a PHP proxy

  4. #4
    Sencha User
    Join Date
    Sep 2011
    Posts
    8
    Vote Rating
    0
    aharley40 is on a distinguished road

      0  

    Default


    Quote Originally Posted by aCa View Post
    Take a look as JSONP and ScriptTagProxy. Also read this wiki page: http://en.wikipedia.org/wiki/Same_origin_policy.

    I think he is right. You should probably try Ext.util.JSONP.request() instead and see if that works out for you

  5. #5
    Sencha - Services Team AndreaCammarata's Avatar
    Join Date
    Jun 2009
    Posts
    1,394
    Vote Rating
    22
    AndreaCammarata has a spectacular aura about AndreaCammarata has a spectacular aura about

      0  

    Default


    Quote Originally Posted by Racon View Post
    XMLHttpRequest cannot load http://xyz. Origin http://localhost is not allowed by Access-Control-Allow-Origin.

    I get this Exception in my Chrome Browser.

    The server I run is Apache (XAMPP).

    How can I fix this? What can I do?

    Thank you very much

    My Source Code:

    <script type="text/javascript">

    new Ext.Application({

    name: 'Hello World',

    launch: function() {



    Ext.Ajax.request({

    url: 'http://xyz',

    method: 'GET',

    headers: {'Authorization': 'Basic GVU0IXZ6cFGzczE='},

    success: function(response, opts) {

    var obj = Ext.decode(response.responseText);

    console.dir(obj);

    },

    failure: function(response, opts) {

    console.log('server-side failure with status code ' + response.status);

    }

    });



    }

    });

    </script>
    Hi Racon.
    If you are trying to get data from a domain that is not your businness you have to use JSONP due to the same origin policy.
    However, If you are developing an application on localhost that you will upload on the same domain you are trying to get data from, you don't need to use JSONP!
    In this case you only need to open you application from file://.... intead of http://localhost/...
    This will makes the trick and will allow you to get data from a different domain.

    Hope this helps.
    Sencha Inc
    Andrea Cammarata, Solutions Engineer
    CEO at SIMACS

    @AndreaCammarata
    www.andreacammarata.com
    github: https://github.com/AndreaCammarata

    TUX components bundle for Sencha Touch 2.x.x
    http://www.tux-components.com/


film izle

hd film izle

film sitesi

takipci kazanma sitesi

takipci kazanma sitesi

güzel olan herşey

takipci alma sitesi

komik eğlenceli videolar