Hybrid View
-
21 Aug 2012 1:54 AM #1
Unanswered: Parse XML in external API probelem
Unanswered: Parse XML in external API probelem
I need to use external API but I get this error :
XMLHttpRequest cannot loadlocalhost/exempleOriginwww.example.com is not allowed by Access-Control-Allow-Origin.
I foud many developper have the same problem but any clear response. Last time I get the same problem in other project but I was able to solve it using JSONP because I can make changes in the server. But now I can't I have a XML response that I need to parse it, when I test the same URL in the browser I get response without problem.
Any help please?
-
21 Aug 2012 4:39 AM #2
You ran into a same domain policy issue. Your app running at yourapp.com for instance is not allowed to get resources from a different domain: www.example.com.
If you are maintaining www.example.com you can control access to it. See http://enable-cors.org/ on how to do this. If you can't control the config of www.example.com you could use a proxy on yourapp.com domain to retrieve the XML from the other domain.
-
23 Aug 2012 8:17 AM #3
Thank you for your reply, I can't control the example.com also my app will be native and so we will not host it into server only package it.
I use already proxy but I get the same problem message.


Reply With Quote