Wednesday, March 27, 2013

XmlHTTPRequest: “XML Parsing Error: no element found”

I have an html5 application which get details from database through javascript. It is working properly on localhost. But after i move the database to hosting place i get the error XmlHTTPRequest: “XML Parsing Error: no element found”.

This error come because of same origin policy. That mean in my case, database in one host and my application in an another host.

I fix this issue by following steps.(i call database hosting is hostA and my application hosting hostB)

* I have php file on hostA. I add below code to the top of the file.
header('Access-Control-Allow-Origin: *');


0 comments:

Post a Comment