jQuery Example Error


#1

Hello! I’d like to start by saying, I’m new to the forum!

Second, I’d like to ask for some assistance. I’m currently trying to test out the JS API and I can’t get the map to appear…

I’m receiving the following error:



TypeError: result.DecodeFlightRouteResult is undefined
var points = result.DecodeFlightRouteResult.data;

I’ve tried switching flight numbers and have filled in my credentials for the API. Am I doing something wrong or is the example broken?

Thanks!


#2

Typically this is because the flight returned does not have a decodable flight route. Not all flight routes can be automatically decoded by that function, and is not representative of all actions that can be performed using other FlightXML APIs. Try a flight that operates entirely within the continental US for best chances of a decodable flight route.

Also make sure that you are not using Internet Explorer, as it has problems with some of the cross-domain access requirements in that javascript example.


#3

Thanks for those tips!

I’m currently trying flight UAL450 which is in the continental US and I’m running the example in Firefox. Any pointers?

Thanks!
Austin Biggs


#4

BUMP *


#5

The jQuery example was only a proof of concept and is not intended to be the model of an actual application. You should not use FlightXML directly via javascript in the browser for production applications due to the security concerns of disclosing your API Key publicly.


#6

I appreciate the concern, but I’m simply using it as an example to learn from. Also, what I intend to create is inward facing only, and will only be used for internal purposes.

Once again, I appreciate the input, but saying not to use javascript, doesn’t exactly answer my question (this is not intended to sound rude). I intend to fetch the FlightXML via PHP, however, I’m trying to learn how to implement with a javascript mapping technology. And this example is exactly what I’m after…

Thanks!
Austin Biggs


#7

The jQuery example code on our documentation page has been updated with some additional error handling and looping logic that should make it generally more likely to succeed. Please download the new code and retry your testing. In general, I would expect the default UAL423 flight to work.