JSON is the new trend in the API world being practiced and implemented because of the usability, security and cross platform support just like XML. But one aspect in which JSON always outsmarts XML is the size of the response and the request.
As JSON generated at the endpoint API can be accessed by everyone over the globe, by default JSON cannot be shared on different networks or domain. There is a trick need to be done in the .htaccess file. You call this CORS (Cross Origin Resource Sharing). Just add the following line to your .htaccess file and you are good to go.
Header set Access-Control-Allow-Origin, "*"
The above code is too open. Any one over the internet will have access to your data if you use *. If you just want to provide access only to a specific set of websites or just one, try the following method.
Header set Access-Control-Allow-Origin: http://domain1.com
Header set Access-Control-Allow-Origin: http://domain2.com
Header set Access-Control-Allow-Origin: http://domain3.com
Header set Access-Control-Allow-Origin: http://domain4.com
I hope this tip helped you solve.