I need to use external API but I get this error :

XMLHttpRequest cannot load
localhost/exemple
Origin
www.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?