Skip to content Skip to sidebar Skip to footer

Load Bingmaps Api On Runtime

I am trying to load the Bing Maps API during runtime of my JavaScript file. Here is what i have got so far, based on this. var bingmap_link = 'https://www.bing.com/api/maps/mapcont

Solution 1:

You are specifying a callback function in the map script URL but don't have a function with that name in your code. That is causing the error you seeing. Additionally, the code you have will not work as is. The map control loads a bunch of resources asynchronously. As such, then the done function in your could is reached, only the initial javascript file has been loaded, none of the other resources has, so the map API is not available yet. Here is a code sample that shows how to lazy load the map API: https://github.com/Microsoft/BingMapsV8CodeSamples/blob/master/Samples/Map/Lazy%20Loading%20the%20Map.html

You can try it out here: http://bingmapsv8samples.azurewebsites.net/#Lazy%20Loading%20the%20Map

Post a Comment for "Load Bingmaps Api On Runtime"