1. #1
    Sencha User
    Join Date
    Nov 2010
    Posts
    398
    Vote Rating
    6
    gkatz is on a distinguished road

      0  

    Default Json Req from local PC to remote server [truly confused]

    Json Req from local PC to remote server [truly confused]


    Hi all;
    I have a Ajax json request to a remote server like so:
    Code:
    Ext.Ajax.request({
                    url: myRemoteServer,
                    method: 'get',
    this code works perfectly on the native devices (compiled in PG but in the browser I get :
    Code:
    XMLHttpRequest cannot load http://myRemoteServer/forum/rss/recentTopics.page?_dc=1387901550014&limit=25. Origin http://localhost:8080 is not allowed by Access-Control-Allow-Origin.
    now, I can't seem to get why one would work (native) and the other will not (browser). I am a bit confused. any advise would be great.

  2. #2
    Sencha User
    Join Date
    Nov 2010
    Posts
    398
    Vote Rating
    6
    gkatz is on a distinguished road

      0  

    Default


    got my answer from the PGB forum:
    "Hi, as Phonegap uses the file protocol (file:///), there is no domain. So no CORS restrictions apply and plain old AJAX simply works."

  3. #3
    Sencha - Support Team
    Join Date
    Oct 2011
    Posts
    3,970
    Vote Rating
    134
    fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all fmoseley is a name known to all

      0  

    Default


    Thanks for sharing your solution.
    Get more personalized support via a support subscription.

    Want to learn Sencha Touch 2? Check out
    Sencha training
    Sencha Touch in Action

    Need more help with your app? Hire Sencha Services services@sencha.com

    When posting code, please use BBCode's CODE tags.

    Need to include a test case use:
    The official Sencha Fiddle

Thread Participants: 1