var XHR = ("onload" in new XMLHttpRequest()) ? XMLHttpRequest : XDomainRequest;
var xhr = new XHR();
xhr.open('GET', 'http://sub.domains.com', true);
xhr.onload = function() {
alert( "ответ"+this.responseText );
}
document.domain = "osnovnoi-domen.com";
Access-Control-Allow-Origin: http://drugoi-domen.com