Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How geocoder.geocode() works?

My only question is, if browser does not support cross domain AJAX request than How google map api works to get the data.

How following code works ?

<script type="text/javascript" src="http://maps.google.com/maps/api/js?sensor=false"></script>
<script type="text/javascript">
geocoder = new google.maps.Geocoder();
geocoder.geocode( { 'address': address}, function(results, status) {
   if (status == google.maps.GeocoderStatus.OK) {
   }
});
</script>

what geocoder.geocode does internally ?

EDIT: Ok they are including http://maps.gstatic.com/intl/en_us/mapfiles/api-3/9/8/main.js

can anyone tell me where they are using JSONP in their JS Code ?

like image 615
hardik Avatar asked Dec 14 '25 06:12

hardik


1 Answers

It most likely uses JSONp, i.e. it includes a script from the google servers that calls a callback function and passes the response to that function.

like image 137
ThiefMaster Avatar answered Dec 15 '25 20:12

ThiefMaster



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!