Что-то случилось с моим скриптом Google Map API

Я занимался мобильной частью моего проекта после «завершения» веб-части. Я использую Google Map API. Я закодировал следующее:

function codeAddress() {


              var image = 'images/tickmark1.png';
              var address = document.getElementById('address').value;
              geocoder.geocode( { 'address': address}, function(results, status) {
                if (status == google.maps.GeocoderStatus.OK) {

                  map.setCenter(results[0].geometry.location);
                  var markerZad = new google.maps.Marker({
                      map: map,
                      position: results[0].geometry.location,
                      title: "NEW TASK",
                      icon: image
                  });
                  document.getElementById('latitude').value =results[0].geometry.location.nb.toPrecision(9);
                  document.getElementById('longitude').value=results[0].geometry.location.ob.toPrecision(9);
                  document.getElementById('adrs').value=document.getElementById('address').value;
                  document.getElementById('latit').value =results[0].geometry.location.nb.toPrecision(9);
                  document.getElementById('longit').value=results[0].geometry.location.ob.toPrecision(9);
                  alert("Ustalono wspolrzedne nowego zadania. Wybierz pracownika \n (PPM usuwa znacznik)");
                } else {
                  alert('Geocode was not successful for the following reason: ' + status);
                }
              google.maps.event.addListener(markerZad, 'click', function() {
                alert("Nowe zadanie: \n"+ address +  "\n"+"Wybierz pracownika \n (PPM usuwa znacznik)");
                map.setZoom(14);
                map.setCenter(this.getPosition());
              });
              google.maps.event.addListener(markerZad, 'rightclick', function() {
                markerZad.setMap(null);

                document.getElementById('latitude').value =0;
                document.getElementById('longitude').value=0;
                document.getElementById('adrs').value=0;
                document.getElementById('latit').value =0;
                document.getElementById('longit').value=0;
                document.getElementById('ajdideva').value="X";
                document.getElementById('iddev').value=0;
                document.getElementById('baton').disabled=true;
                alert("Usunieto znacznik. Wpisz inny adres.");
              });

            });

    }


Let's leave behind the level of this code. I'm sure it's a bad one. But the thing is...it used to work for me like few days ago. Now it doesn't. And yes, I haven't touched it since then... I figured out myself, that the problem causes "results". I get status==OK, then it places a marker in a correct spot, and then...nothing happens. I mean my inputs in html file don't get their values changed and +listeners aren't working. When I changed "results[0]." etc to simple string, it worked, that's why I think that there's a problem with results[0]. Any suggestions please?

Ответы на вопрос(1)

Ваш ответ на вопрос