Z
Z
Zarathustraa2016-08-01 21:52:26
CORS
Zarathustraa, 2016-08-01 21:52:26

Why is an AJAX request not coming to a third-party site?

I can't figure out why the ajax request doesn't go through on a third party site. Although I prescribe the heading "Access-Control-Allow-Origin: *".

var XHR = ("onload" in new XMLHttpRequest()) ? XMLHttpRequest : XDomainRequest;
var xhr = new XHR();

xhr.open('CORS', 'http://data.teletrade-dj.com/api/quotes/current?authkey=DdQJTOdb9fjI&terms=EURUSD,GBPUSD,USDCAD,GOLD,USDRUR', true);
xhr.setRequestHeader('Access-Control-Allow-Origin', '*');
xhr.onload = function() {
  console.log( this.responseText );
}
xhr.onerror = function() {

}
xhr.send();

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question