user3498437
user3498437

Reputation:

Bing Map api ajax v. 7 Not Displayed

i've a display problem when i try to insert the bing map code in a site made in html5, css3 and jquery, i'm using the sdk ajax v.7 to create the code;

The problem is that when i try to insert the code that give me (with my personal key) and my coordinate the map don't show up, but it remains gray...

I've tried to update the jquery.min.js or rename the doctype in xhtml, but sitll don't work

This is the script code:

<script charset="UTF-8" type="text/javascript" src="https://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&s=1">  </script>



   <script type="text/javascript">
  var map = null;

  function getMap()
  {
      map = new Microsoft.Maps.Map(document.getElementById('myMap'), {credentials: 'mycode', center: new Microsoft.Maps.Location(39.801646 , 15.797405), zoom: 8});
  }   
  </script>

Upvotes: 0

Views: 423

Answers (1)

Nicolas Boonaert
Nicolas Boonaert

Reputation: 2952

I'm sure the iSDK for Bing Maps could be useful. Here is a sample code that loads the map:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
   <head>
      <title>Map with valid credentials</title>
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
      <script type="text/javascript" src="http://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0"></script>
      <script type="text/javascript">
      var map = null;

      function getMap()
      {
          map = new Microsoft.Maps.Map(document.getElementById('myMap'), {credentials: 'Your Bing Maps Key'});
      }   
      </script>
   </head>
   <body onload="getMap();">
      <div id='myMap' style="position:relative; width:400px; height:400px;"></div>
   </body>
</html>

Several things to consider if this code it not working:

  • Try to reach Bing Maps AJAX source uri
  • Try to add alerts or log inside the methods to follow what is executed

Let us know if you need anymore information.

Upvotes: 1

Related Questions