Reputation: 1932
i am trying to add the open MapQuest leaflet plugins to my webapp. When I run the app I get this error in the console:
Uncaught ReferenceError: L is not defined
It is in line 45 of the mapquest js files that I add. I have an open app key and I am using the open js files and the open plugins. I have added these to my app and I have replaced the "YOUR_KEY_HERE" with my open appkey.
<script src="http://open.mapquestapi.com/sdk/leaflet/v1.s/mq-map.js?key=YOUR_KEY_HERE"></script>
<script src="http://open.mapquestapi.com/sdk/leaflet/v1.s/mq-geocoding.js?key=YOUR_KEY_HERE"></script>
Why am I getting this error and how do i fix it. Let me know if you need to see any code.
Upvotes: 0
Views: 1080
Reputation: 28668
You get that error when it can't find L
in global scope, the Leaflet object. You should include Leaflet before those scripts:
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.7.3/leaflet.js"></script>
Upvotes: 2