I want to write a javascript code to fetch data from koha (An ILS)
<p>I'm a beginner in learning Javascipt. What I want to do is to fetch data from Koha library system using javascript code. Koha uses Apache2 web server and MySQL database to store catalogues.</p>

<p>My code was:</p>

<pre><code>&lt;!DOCTYPE html&gt;
&lt;html&gt;
&lt;body&gt;

&lt;div id="demo"&gt;&lt;h2&gt;Result&lt;/h2&gt;&lt;/div&gt;


&lt;script&gt;
  var xhttp = new XMLHttpRequest();
  xhttp.open("GET","http://127.0.0.1:8080/cgi-bin/koha/svc/bib/3?userid=user&amp;password=user1", false);
  xhttp.send();

  xmlDoc = xhttp.responseXML;
  txt = "";
  x = xmlDoc.getElementsByTagName("a");
  for (i = 0; i &lt; x.length; i++) {
  txt += x[i].childNodes[0].nodeValue + "&lt;br&gt;";
   }
   document.getElementById("demo").innerHTML = txt;
&lt;/script&gt;

&lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>It doesnt work.</p>

<p>When I type the url: </p>

<p><a href="http://127.0.0.1:8080/cgi-bin/koha/svc/bib/3?userid=user&amp;password=user1" rel="nofollow">http://127.0.0.1:8080/cgi-bin/koha/svc/bib/3?userid=user&amp;password=user1</a>  </p>

<p>in my browser I get this</p>

<pre><code>This XML file does not appear to have any style information associated with it. The document tree is shown below.

    &lt;record xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://www.loc.gov/MARC21/slim" xsi:schemaLocation="http://www.loc.gov/MARC21/slim http://www.loc.gov/standards/marcxml/schema/MARC21slim.xsd"&gt;
    &lt;leader&gt;00099nam a22000617a 4500&lt;/leader&gt;
    &lt;datafield tag="020" ind1=" " ind2=" "&gt;
    &lt;subfield code="a"&gt;234234&lt;/subfield&gt;
    &lt;/datafield&gt;
    &lt;datafield tag="245" ind1=" " ind2=" "&gt;
    &lt;subfield code="a"&gt;Harry Potter&lt;/subfield&gt;
    &lt;/datafield&gt;
    &lt;datafield tag="999" ind1=" " ind2=" "&gt;
    &lt;subfield code="c"&gt;3&lt;/subfield&gt;
    &lt;subfield code="d"&gt;3&lt;/subfield&gt;
    &lt;/datafield&gt;
    &lt;/record&gt;
</code></pre>

<p>I want to get the output using javascript. Please help!</p>