locked
Bing Map Weird Error [HTML5]

    Question

  • I have been working on metro app for couple of week's i am struck with an weird error that show while building the project. It shows an error in API file i dono how to fix it. SOme one plese help  me guys.

    In the code i am trying to do the Bussiness search functionality of bing. The code as below

     window.onload(GetMap());
               var map;
    
               function GetMap() {
    
                   map = new Microsoft.Maps.Map(document.getElementById("mapDiv"), {
    
                       credentials: "My Credential",
                       center: new Microsoft.Maps.Location(47.5, -122.3),
                       zoom: 9,
                       height: 800,
                       width: 1276,
                       showMapTypeSelector: false
                      
                   });
    
                   Microsoft.Maps.loadModule('Microsoft.Maps.Search', { callback: searchModuleLoaded });
                   
    
               }
    
    
               function searchModuleLoaded() {
                   var searchManager = new Microsoft.Maps.Search.SearchManager(map);
    
                   var searchRequest = {
                       what: "pizza",
                       where: "Seattle",
                       count: 10,
                       startIndex: 0,
                       callback: searchCallback,
                       userData : { name: 'Maps Test User', id: 'XYZ' },
                       errorCallback: searchError
    
                   };
                   searchManager.search(searchRequest);
                  // return new WinJS.Promise.wrap(null);
               }
    
               function searchCallback(searchResponse, userData) {
                   console.log("The first search result is " + searchResponse.searchResults[0].name + ".");
               }
    
    
               function searchError(searchRequest) {
                   console.log("An error occurred.");
               }
    

    Friday, August 3, 2012 11:50 PM

Answers