Need some help with JSON

Hello and thanks for reading!

I’m setting up a simple query to get plane types from flightaware to make schedules for Tower3D…

I get this error:
Failed to load resource: the server responded with a status of 401 (Authorization Required)

The error shows the URL which oddly enough fetches the JSON data just fine when I click it…

This is the code I use right now to test, been a while so it’s well possible I am making a mistake here…:

<script type="text/javascript">

var flURL = 'http://ID:APIKEY@flightxml.flightaware.com/json/FlightXML2/FlightInfoEx';
var flNum = 'AA654'

$(document).ready(function() {
  $('#testpoint').html("URL = " + flURL);
  $.ajax({
    type: 'GET',
    url: flURL ,
    data: { 'ident': flNum , 'howMany': 1 } ,
    success : function(fRes) {

      if (fRes.error) {
        $('#flightRes').html('Failed to fetch data: ' + fRes.error);
        return;
      };
      $('#flightRes').html('Returned: ' + fRes.FlightInfoExResult);
    }
  });
});

</script>

We do not recommend using FlightXML through Javascript within the browser due to the need for authentication. This style of access is being depreciated by most browsers. We are encouraging users to develop backend server-based applications instead.