0

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>

1 Answers1

1

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.

Nicolas Boonaert
  • 2,954
  • 1
  • 20
  • 28
  • I thank you for your reply, but the code you posted is the same as what I wrote, so I could not have changes... About the method to create a log of what happened you have any suggestions how to make it? –  Apr 09 '14 at 12:37
  • This code is working pretty well on my side so, once again, I would recommend to check your network capabilities. Then for logging in JavaScript, I recommend this: http://stackoverflow.com/questions/4743730/what-is-console-log-and-how-do-i-use-it – Nicolas Boonaert Apr 10 '14 at 22:48