none
Ajax Bing Map Service Is not calling the service Properly Why? RRS feed

  • Question

  • Hello Experts,

      I am using Ajax BingMap service in my application,but while the request is processing the respons is slow and I am using that one in CRM Online (polaris version). Ajax service is not calling properly for some time .How can I update my code or service ,provide some code it is helpful.

    My code is like this ...

                                                

     function callRouteService(credentials) {
             var start="489 5th Ave,New York,NY,10017";var end="1886 Broadway,New York,NY,10023";

                  var routeRequest = encodeURI('https://dev.virtualearth.net/REST/v1/Routes/Driving?wp.0=' + start + '&wp.1=' + end + '&tl=0.00000344978&optmz=distance&avoid=minimizeTolls&output=json&jsonp=routeCallback&key=' + credentials);        
                  var script = document.createElement("script");
                  script.setAttribute("type", "text/javascript");
                  script.setAttribute("src", routeRequest);
                  document.body.appendChild(script);

              }

              function routeCallback(result) {
                  // ;

                  if (result && result.resourceSets && result.resourceSets.length > 0 && result.resourceSets[0].resources && result.resourceSets[0].resources.length > 0) {
                  var res = result.resourceSets[0].resources[0];
                  var routeArr = new Array();
                  var distanceArray = new Array();
                  var routeDetail = "";
                  var Key = "";                                   
                      for (var i = 0; i < res.routeLegs[0].itineraryItems.length; i++) {
                          routeArr[i] = res.routeLegs[0].itineraryItems[i].instruction.text;
                          distanceArray[i] = res.routeLegs[0].itineraryItems[i].travelDistance;
                      }
                      for (k = 0; k < routeArr.length; k++) {
                          routeDetail += routeArr[k] + "*" + distanceArray[k];
                          //alert(routeArr[k]);
                      }
                         Key = customerName;                  
                          customerDetailList[position] = Key + "-" + routeDetail;
                          position += 1;

                  }

    Thanks and regards

    Muralikrishna



    • Edited by 2014crm Thursday, July 18, 2013 8:59 AM
    Thursday, July 18, 2013 8:50 AM

Answers

  • Ok, there is nothing wrong with the service. What's null? The Bing Maps control doesn't have a callback when it loads. Is your app trying to access the Bing Maps control before it is loaded?

    http://rbrundritt.wordpress.com

    Thursday, July 18, 2013 3:19 PM

All replies

  • Can you provide more details? The service running fine as normal. Which version of Bing Maps are you using?  Are you seeing any errors? Where are you trying to access Bing Maps from (i.e. US).

    http://rbrundritt.wordpress.com

    Thursday, July 18, 2013 9:00 AM
  • Hi,

    Thanks for reply.

    I am using  Bingmap 7.0 ,I am using Bing map from India. I got no errors. In callback the result is getting null . I am using this link for Bingmap  "https://ecn.dev.virtualearth.net/mapcontrol/mapcontrol.ashx?v=7.0&s=1" 

         .I am using trail version key.

    Some time the result as I expected. but not all cases. can you help me what might be the wrong.

    Thanks and regards

    Murali


    • Edited by 2014crm Thursday, July 18, 2013 10:30 AM update
    Thursday, July 18, 2013 10:25 AM
  • Ok, there is nothing wrong with the service. What's null? The Bing Maps control doesn't have a callback when it loads. Is your app trying to access the Bing Maps control before it is loaded?

    http://rbrundritt.wordpress.com

    Thursday, July 18, 2013 3:19 PM