As per Same Origin policity, you can access data from another page using script. But that page and script should be from the same origin. This is mainly for the security reasons. Say, you are on http://mayurshah.in and you login. Now navigate to http://www.mayurshah.in it will not show you logged in. This is to prevent cross domain hacking.
To avoid same origin policy, you will have to allow any origin on the server.
Example for Apache:
add following line to the server config file or .htaccess file.
Header set Access-Control-Allow-Origin "*"
To verify your changes,
apachectl -t
Now just restart the apache server.
sudo service apache2 reload
Also, altering requires the user of mode_headers so,
a2enmod headers
Hope that helps!