[XMLHttpRequest] Cross-domain Ajax REST request + No ‘Access-Control-Allow-Origin’ header is present on the requested resource

Context :

In summary, this article is to record the solution for an “No ‘Access-Control-Allow-Origin’ header is present on the requested ressource” error.

My local domain is : localhost, in which based my local application

My request domain is : http://www.example.com, which is write in PHP, and will return a simple object in JSON
Such as : {"return":"OK"}

Continue reading