We encountered weird error when we are requesting to another domain. Actually it is the same domain but on a sub domain.
Here was the error I encountered
I went to my .htaccess and I add this line of code.
Header add Access-Control-Allow-Origin http://www.domain.com
This will specify the domain you want to allow for security purposes and solve my issue.