I am trying to build a little tool using google maps API. I thought With the use of the distanceMartrix api I could actually do this with just html/javascript

```
$.get("http://maps.googleapis.com/maps/api/distancematrix/json?origins=Vancouver+BC&destinations=San+Francisco|Victoria+BC&sensor=false", function(data){
    alert("Hello world");
});

```

the above code fails to success on the alert. I can get it to alert before the function and I have jquery commands before this which all perform fine. So what is going wrong in this incredibly simple statement? (im guessing its something stupid because im tired!!)
['https://Stackoverflow.com/questions/8980329', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/369765/']
looks like you need to include google maps v3 js library via tag `script` and then use this service <http://code.google.com/apis/maps/documentation/javascript/reference.html#DistanceMatrixService>

there will be somethnmg like this

```
<script type="text/javascript" src="http://maps.googleapis.com/maps/api/js?sensor=false"></script>

<script type=text/javascript">
    var service = new google.maps.DistanceMatrixService();
    service.getDistanceMatrix(

          {
            origins: [...], //array of origins
            destinations: [...], //aray of destionations
            travelMode: google.maps.TravelMode.DRIVING,
            unitSystem: google.maps.UnitSystem.METRIC,
            avoidHighways: false,
            avoidTolls: false
          }, function(response, status){
              if(status==google.maps.DistanceMatrixStatus.OK)
              {
                  alert('ok')
              }
          });
      }
</script>

```

`

**UPD:**

I have some trobles with formatting code, but I hope you guess what I mean.
Since you are making an "AJAX" request from a different domain than your script it needs to be a JSONP request instead of just a JSON request. JSONP requires a callback in your script that receives the data and processes it. Many APIs will serve up a JSONP request if you just append `&callback=?` to the end of the URL. jQuery will take care of the rest, making it go to the success callback.

I'm guessing that is it.