I'm using an Elsevier API to fetch a book listing. To do this, I'm using an example from them at this link: link I did my registration, got my APIkey and got the following code:
<html>
<head>
<title>Elsevier ScienceDirect Search via APIs</title>
<link rel="icon" type="image/png" href="images/favicon.ico" />
<script>
var xsl="";
var xml="";
function loadXMLDoc(dname) {
if (window.ActiveXObject) {
xhttp=new ActiveXObject("Msxml2.XMLHTTP.3.0");
}
else {
//alert ("in ActiveXObject ELSE condition");
xhttp=new XMLHttpRequest();
}
xhttp.open("GET",dname,false);
xhttp.send("");
return xhttp.responseXML;
}
function displayResult()
{
xml="";
var key="20d0c__________________________adb"; // API key value
document.getElementById("sd_results").innerHTML="";
//alert("in displayResult()");
var x = document.getElementById("form1");
var val = x.elements[0].value;
var apiReq="http://api.elsevier.com/content/search/index:SCIDIR?query="+val+"&apiKey="+key+"&xml-decode=true&httpAccept=application%2Fxml";
if (xsl == "") {
xsl=loadXMLDoc("sd_results_webkit.xsl");
}
//alert('getting xml');
xml=loadXMLDoc(apiReq);
// code for IE
if (window.ActiveXObject)
{
var ex='';
ex=xml.transformNode(xsl);
document.getElementById("sd_results").innerHTML=ex;
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
{
xsltProcessor=new XSLTProcessor();
xsltProcessor.importStylesheet(xsl);
resultDocument = xsltProcessor.transformToFragment(xml,document);
document.getElementById("sd_results").appendChild(resultDocument);
}
}
function formReset() {
document.getElementById("form1").reset();
}
function displayPage(link) {
xml="";
document.getElementById("sd_results").innerHTML="";
var apiReq=link;
if (xsl == "") {
xsl=loadXMLDoc("sd_results_webkit.xsl");
}
//alert('getting xml');
xml=loadXMLDoc(apiReq);
// code for IE
if (window.ActiveXObject)
{
var ex='';
ex=xml.transformNode(xsl);
document.getElementById("sd_results").innerHTML=ex;
}
// code for Mozilla, Firefox, Opera, etc.
else if (document.implementation && document.implementation.createDocument)
{
xsltProcessor=new XSLTProcessor();
xsltProcessor.importStylesheet(xsl);
resultDocument = xsltProcessor.transformToFragment(xml,document);
document.getElementById("sd_results").appendChild(resultDocument);
}
}
</script>
<title>Elsevier ScienceDirect Search API</title>
</head>
<body onload="formReset();return false;">
<form id="form1" onkeypress="return event.keyCode != 13;">
<b>Please enter search keywords separated by space:</b> <input type="text" name="query" style="width:200px"/></form>
<input type="submit" onclick="displayResult();return false;" value="Search" />
<div id="sd_results"></div>
</body>
</html>
What happens, is that when ordering gives me the following error "Cross-Origin blocked request":
This error is with what? I'm making this request on the link that was registered, all right. What will this error be?