Error: Origin is not allowed by Access-Control-Allow-Origin

i’m trying to retrive a xml from an url, to do that i wrote the following lines

dhx.ajax("", function(text){
	var txt=text;

inspecting the document with firebug the txt variable is an empty string and I also get the error:

XMLHttpRequest cannot load Origin is not allowed by Access-Control-Allow-Origin

I also tried with others urls and I get the same error.
(I’m using aptana as IDE and I tried both the embedded web server and apache web server to run the mobile application).
Do you know how I can resolve this problem?


Is the main html page also loaded from the same url - ?
Otherwise browser will block data loading because of cross domain security
( you can configure headers in server’s response to allow cross domain request for FF and WebKit browsers )

Thanks Stanislav for your response,
the html is loaded from, that is why I’m getting thi error. I serched on google and I saw that making a request with “Access-Control-Allow-Origin” I can bypass the problem, so my question is how can I make a request with that parameter Access-Control-Allow-Origin with dhtmlx framework?

The current header that is generating is the following:

Request URL:
Request Headersview parsed


User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/535.2 (KHTML, like Gecko) Chrome/15.0.874.106 Safari/535.2


As you commented in your answer do you think if I make the same above request and the server put in the response headers the parameter:
it is going to work?

Thanks again for your advices

That must be the header in the response, not in the ajax call.
In case of apache - you can add instructions to output such header through .htaccess file


I know it’s an old ticket, but I leave this comment in case someone has the same error that I had.

After a study of the request sent by Gantt with the .load(url) method, I noticed that it sends a specific header x-requested-with, so to solve this problem I added it at the level of my filter.

For info I use a backend in Java: