In php files put these 2 lines at the top of the file
<?php
header('Content-Type: application/json');
header('Access-Control-Allow-Headers: *');
Add a .htaccess file in the the root directory of server side files and the line
Header set Access-Control-Allow-Origin "*"