title: GET DATA from XML and show on HTML - Input variable
body: <p>I'm trying to get data from a xml file and show inside inputs, but I need to get a parameter from a input.</p>
  <p>This code is working when just click on the button, but it return the xml file with the parameter <strong>'sbbr'</strong></p>
  <p>this is my code:</p>
  <pre><code>&lt;script&gt;
    var icaocode = 'sbbr'
    var client;
    if (window.XMLHttpRequest) {
      client = new XMLHttpRequest();
    } else {
      client = new ActiveXObject(&quot;Microsoft.XMLHTTP&quot;);
    }
  
    client.open('GET', 'https://mywebsite.com/api/?icaoCode=' + icaocode, true);
  
    function buscarFunction() {
  
      var xmlDoc = client.responseXML;
  
      var heliponto = xmlDoc.getElementsByTagName(&quot;aisweb&quot;);
      for (i = 0; i &lt; heliponto.length; i++) {
        data = heliponto[i].getElementsByTagName(&quot;name&quot;)[0].childNodes[0].nodeValue;
        city = heliponto[i].getElementsByTagName(&quot;city&quot;)[0].childNodes[0].nodeValue;
        org = heliponto[i].getElementsByTagName(&quot;rmkText&quot;)[0].childNodes[0].nodeValue;
      }
  
      document.getElementById('nome').value = data;
      document.getElementById('cidade').value = city;
      document.getElementById('org').value = org;
    }
    client.send();
  &lt;/script&gt;
  &lt;input id=&quot;icao&quot;&gt;&lt;button type=&quot;button&quot; onclick=&quot;buscarFunction()&quot;&gt;Buscar&lt;/button&gt;&lt;Br&gt;
  &lt;input id=&quot;nome&quot;&gt;&lt;br&gt;
  &lt;input id=&quot;cidade&quot;&gt;&lt;br&gt;
  &lt;input id=&quot;org&quot;&gt;
  </code></pre>
  <p>I need to get this paramenter from here:</p>
  <pre><code>&lt;input id=&quot;icao&quot;&gt;&lt;button type=&quot;button&quot; onclick=&quot;buscarFunction()&quot;&gt;Buscar&lt;/button&gt;
  </code></pre>
  <p>but is not populating the variable <strong>icaocode</strong>, I have tryed this:</p>
  <pre><code>var icaocode = document.getElementById('icao').value;
  client.open('GET', 'https://mywebsite.com/api/?icaoCode=' + icaocode, true);
  </code></pre>