Take the 2-minute tour ×

I'm using this method when file is loaded:

$("<script/>", { "class": "test", "src": 'http://www.externalSite.com/js/xxx.js' }).appendTo("head");

the file is loaded fine and no problem with it.

Im try to make an ajax call in this file to get some data from the server DB, and then simply alert the result.

When Im making the call from the same server it works good, but when Im trying to call this script from an outside server it alerts an empty string

share|improve this question
add comment

1 Answer

up vote 1 down vote accepted

Ajax can't be used to get data from another server, it's called the same origin policy, the hostname and port number must be identical to be able to make a request.

share|improve this answer
add comment

Your Answer


