javascript - geocoder.geocode function does not work -
Hi, I want to land down the place I entered.
But it seems that the geocoder.geocode function does not work
here it is part of the JavaScript
$ ('#InputButtonGeocode'). Click (function () {var sAddress = document.getElementById ('inputTextAddress') .value; geocoder.geocode ({'address': sAddress}, function (result, status) {if (position == google.maps.GeocoderStatus .oK) {map.setCenter (Results [0] .geometry.location); Var Marker = New google.maps.Marker ({Map: Map, Status: Results [0] .geometry.location});} and {Warning} ("The geocode was not successful for the following reason:" + status); This should be a simple problem, but I can not find this problem
That is JSFDL link.
Please help me Thanks,
Good things. It does not seem that your initial function is ever going and therefore Your geographic object can never be created, and this API is not compatible with the Google Maps Embed (iframe) API. For example, you can see that they use the following to create a geographic and Then creating a map:
map = new google.maps.Map (document. GetElementById ("map-canvas"), map options);
They specify the map as a variable. And then they are using variables so that a marker can be entered in order to put that marker on the right map ..
var marker = new google.maps.Marker ({Map: Map, Status: Results [0] .geometry.location});
Also do not forget to load the actual Google Maps API. The Jquery plugin gives you the ability to handle events in the map but it does not actually load the API. An example of loading the API's asynchronous is simple and easy to see, you can load it like any other script.
Comments
Post a Comment