Answer the question
In order to leave comments, you need to log in
How to remake ajax request using jsonp?
There is an AJAX request that doesn't work in IE . I so believe that a problem in request. In this regard, I decided that jsonp can be used . This is where my ideas run out and I feel helpless in trying to deal with it. Maybe someone will tell?
$.ajax({
url: 'http://maps.googleapis.com/maps/api/geocode/json?address='+address,
dataType: 'json',
type: 'GET',
success: function(response){
if(response.results.length) {
responseCoords=new google.maps.LatLng(response.results[0].geometry.location.lat, response.results[0].geometry.location.lng);
calcRoute(responseCoords);
}
}
});
Answer the question
In order to leave comments, you need to log in
Use the Google-Api library, don't pull their json directly.
Your example will look like this:
1) Connect their library
2) pull their API through their library
<script type="text/javascript">
var geocoder = new google.maps.Geocoder();
var address = 'London, UK';
if (geocoder) {
geocoder.geocode({ 'address': address }, function (response, status) {
if (status == google.maps.GeocoderStatus.OK) {
responseCoords = new google.maps.LatLng(response.results[0].geometry.location.lat, response.results[0].geometry.location.lng);
calcRoute(responseCoords);
}
});
}
</script>
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question