# jQuery Example Error

**URL:** <https://discussions.flightaware.com/t/jquery-example-error/17366>\
**Category:** AeroAPI\
**Created:** [September 29, 2015, 6:37am UTC](https://discussions.flightaware.com/t/jquery-example-error/17366 "2015-09-29T06:37:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![klikdenver](https://avatars.discourse-cdn.com/v4/letter/k/f475e1/32.png) [@klikdenver](https://discussions.flightaware.com/u/klikdenver)\
**Post date:** [September 29, 2015, 6:37am UTC](https://discussions.flightaware.com/t/jquery-example-error/17366/1 "2015-09-29T06:37:19Z")

</div>

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:

```auto

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!

---

<div class="post-metadata">

**Author:** ![bovineone](https://sea1.discourse-cdn.com/flex019/user_avatar/discussions.flightaware.com/bovineone/32/117631_2.png) [@bovineone](https://discussions.flightaware.com/u/bovineone)\
**Post date:** [October 1, 2015, 4:18pm UTC](https://discussions.flightaware.com/t/jquery-example-error/17366/2 "2015-10-01T16:18:16Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![klikdenver](https://avatars.discourse-cdn.com/v4/letter/k/f475e1/32.png) [@klikdenver](https://discussions.flightaware.com/u/klikdenver)\
**Post date:** [October 1, 2015, 8:38pm UTC](https://discussions.flightaware.com/t/jquery-example-error/17366/3 "2015-10-01T20:38:41Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![klikdenver](https://avatars.discourse-cdn.com/v4/letter/k/f475e1/32.png) [@klikdenver](https://discussions.flightaware.com/u/klikdenver)\
**Post date:** [October 5, 2015, 10:45pm UTC](https://discussions.flightaware.com/t/jquery-example-error/17366/4 "2015-10-05T22:45:22Z")

</div>

BUMP \*

---

<div class="post-metadata">

**Author:** ![bovineone](https://sea1.discourse-cdn.com/flex019/user_avatar/discussions.flightaware.com/bovineone/32/117631_2.png) [@bovineone](https://discussions.flightaware.com/u/bovineone)\
**Post date:** [October 5, 2015, 11:51pm UTC](https://discussions.flightaware.com/t/jquery-example-error/17366/5 "2015-10-05T23:51:18Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![klikdenver](https://avatars.discourse-cdn.com/v4/letter/k/f475e1/32.png) [@klikdenver](https://discussions.flightaware.com/u/klikdenver)\
**Post date:** [October 5, 2015, 11:58pm UTC](https://discussions.flightaware.com/t/jquery-example-error/17366/6 "2015-10-05T23:58:26Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![bovineone](https://sea1.discourse-cdn.com/flex019/user_avatar/discussions.flightaware.com/bovineone/32/117631_2.png) [@bovineone](https://discussions.flightaware.com/u/bovineone)\
**Post date:** [October 6, 2015, 10:44pm UTC](https://discussions.flightaware.com/t/jquery-example-error/17366/7 "2015-10-06T22:44:52Z")

</div>

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.
