I've a start point zip : 10010 and an array of zips {10011,11015,11008}
Now, I want to find lowest path between start point and arrays zips.
I'm trying google v3 apis for searching. But now successful. Any suggestion ?
I'm using : https://maps.googleapis.com/maps/api/distancematrix/json?origins=10010&destinations=10011|10012&key=AIzaSyBOsjeskUwOLYQZntsv7_34gVZ3xgcXko0
Here is my code:
jQuery(function() {
jQuery("input#search_clinic").click(function() {
var start_point = jQuery("input#zip_code").val();
alert(start_point);
var search_zip = "";
jQuery("select#select_location option").each(function()
{
var option_val = jQuery(this).val();
alert(option_val);
search_zip += option_val + "|";
});
var api_key = "AIzaSyBOsjeskUwOLYQZntsv7_34gVZ3xgcXko0";
var url = "https://maps.googleapis.com/maps/api/distancematrix/json?origins="+start_point+"&destinations="+search_zip+"&key=AIzaSyBOsjeskUwOLYQZntsv7_34gVZ3xgcXko0";
jQuery.ajax({
dataType: "json",
url: url,
success: function( data ) {
alert(data);
},
error: function(e) {
}
});
});
});
But return :
XMLHttpRequest cannot load https://maps.googleapis.com/maps/api/distancematrix/json?origins=10010&destinations=44004|44060|&key=AIzaSyBOsjeskUwOLYQZntsv7_34gVZ3xgcXko0. No 'Access-Control-Allow-Origin' header is present on the requested resource. Origin 'http://belsonohearingcenters_two' is therefore not allowed access.