I happen to have an error in the browser when extracting the xml data from an external domain through jquery ajax.
I try to do it this way:
$.ajax({
type: "GET" ,
url: "http://api.radionomy.com/currentsong.cfm?radiouid=E8FBFBE1-E50F-4E6A-BEA7-CA2E41F96D0B&apikey=cf41bd17-7638-4c10-b869-341555a65d7f&type=xml&previous=yes&next=yes&cover=yes&callmeback=yes&defaultcover=yes" ,
dataType: "xml" ,
success: function(xml) {
var title = $(xml).find('title').text(),
artist = $(xml).find('artists').text();
Actc(title, artist);
}
});
That ajax request I have it in a setinterval that updates the data every 20 seconds.
It goes well for a while, but then gives this error in the browser (Chrome) and stops reading the xml information:
yes "> link : No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin ' link ' is therefore not allowed access. The response had HTTP status code 403.
I have searched for information but I can not clarify. It seems that it is not possible to extract xml content from a different domain with ajax unless CORS is enabled on my server.
Although I tried to add it to .httaccess without success, since I kept giving the error. I have also tried to do it by php but also without success. Surely I do something wrong, I'm not very expert in this regard.
How could I extract the XML data without CORS problems?