title: Get XML from server with Ajax GET
body: <p>Posting this question again, as the code is completely different this time.</p>
  
  <p>Trying to get flight information in XML format from Avinor (Norwegian aviation authorities). Example of query: <a href="http://flydata.avinor.no/XmlFeed.asp?TimeFrom=1&amp;TimeTo=7&amp;airport=OSL&amp;direction=D&amp;lastUpdate=2016-04-04T15:03:00Z" rel="nofollow">http://flydata.avinor.no/XmlFeed.asp?TimeFrom=1&amp;TimeTo=7&amp;airport=OSL&amp;direction=D&amp;lastUpdate=2016-04-04T15:03:00Z</a></p>
  
  <p>I've made an Ajax GET query in order to parse the xml feed into my html p with id=flights, but with no success. I get this error in Firebug console:</p>
  
  <p><strong>SyntaxError: expected expression, got '&lt;'</strong></p>
  
  <p>Firebug->Net->Headers displays the following:</p>
  
  <pre><code>Response headers
  Cache-Control   private
  Content-Length  28088
  Content-Type    text/xml; Charset=iso-8859-1
  Date    Mon, 04 Apr 2016 18:32:07 GMT
  Server  Microsoft-IIS/7.0
  X-Powered-By    ASP.NET
  
  Request headers
  Accept  */*
  Accept-Encoding gzip, deflate
  Accept-Language en-US,en;q=0.5
  Connection  keep-alive
  Host    flydata.avinor.no
  User-Agent  Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:45.0) Gecko/20100101 Firefox/45.0
  </code></pre>
  
  <p>When I go into Firebug->Net->XML, I can see the XML data just fine. Can anyone please help me figure this out?</p>
  
  <pre><code>&lt;!DOCTYPE html&gt;
  &lt;html&gt;
  &lt;head&gt;
  &lt;meta charset="utf-8" /&gt;
  &lt;/head&gt;
  &lt;body&gt;
  &lt;script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.0.0-beta1/jquery.min.js"&gt;&lt;/script&gt;
  
  &lt;button type="button" onclick="loadFlights()"&gt;
  Get Flights&lt;/button&gt;
  
  &lt;p id="flights"&gt;&lt;/p&gt;
  
  &lt;script&gt;
  
  function loadFlights() {
  
   var url = "http://flydata.avinor.no/XmlFeed.asp?TimeFrom=1&amp;TimeTo=7&amp;airport=OSL&amp;direction=D&amp;lastUpdate=2016-04-04T15:03:00Z";
    $.ajax({
      url: url,
      type: "GET",
      dataType: "jsonp",
      success: function myFunction(xml) {
    var x, i, xmlDoc, txt;
    xmlDoc = xml.responseXML;
    txt = "";
    x = xmlDoc.getElementsByTagName("flight_id");
    for (i = 0; i&lt; x.length; i++) {
      txt += x[i].childNodes[0].nodeValue + "&lt;br&gt;";
    }
    document.getElementById("flights").innerHTML = txt;
  }
    }); 
  };
  
  &lt;/script&gt;
  
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>