Help consuming REST from javascript

I´ve tried to use your example to consume REST from javascript, but it always failed and prompt for authentication. Any suggestion?

Please de need a quick answer to this case.

Browsers have started blocking sending authorization headers in an http ajax request. We also don’t recommend making the API call in your page’s javascript as it exposes your key and username. Instead we recommend making the request to the FlightXML api from your webserver and then marshaling that data back to your frontend however you prefer.

Hello Team,
i have consuming or getting JMS data for Flights en routing and all details after making connection to the solace (SWIM) in the form of payload(.XML) and want to used this data(JMS/XML) to track live flights on map. please anyone here tell me any UI which integrates or consumes xml and show me the flights on map.
Thanking you in advance!