2013-09-04 6 views
-1

Я использовал карту Google с одним из моих application.I имел мою разметку как этоткарта Google показывает NetworkError: 403 Forbidden - http://maps.googleapis.com/maps/api/js/QuotaService.RecordEvent

<div> 
    <label>Property Location</label> 
    <input class="text-input" type="text" name="property_location" id="property_location" value=""/> 
</div> 

Я использую gmap3, чтобы показать Google map.My код расслоение плотной показывает карту, как его

jQuery(document).ready(function() { 
    jQuery('#property_location').blur(function() { 
    var the_address = jQuery(this).val(); 
    var geocoder = new google.maps.Geocoder(); 
    var latLng = geocoder.geocode({ 
     address: the_address 
    }, function(results, status) { 

    /// IF WE HAVE A RESULT 
    if(status == google.maps.GeocoderStatus.OK) { 
    lat = results[0].geometry.location.lat(); 
    lng = results[0].geometry.location.lng(); 
    jQuery('#latitude').val(lat); 
    jQuery('#longitude').val(lng); 

    jQuery(gMap).gmap3({ 
     get: { 
     name: 'marker', 
     all: true, 
     callback: function(objs) { 
      jQuery.each(objs, function(i, obj) { 
      obj.setMap(null); 
      }) 
     } 
     }, 
     map: { 
     options: { 
      zoom: 10, 
      center: new google.maps.LatLng(lat, lng) 
     } 
     }, 
     marker: { 
      values: [{ latLng:[lat, lng] }], 
      //jQuery(console.log(values)); 
      options: { 
      draggable: true, 
      icon: new google.maps.MarkerImage(
      "http://gmap3.net/skin/gmap/magicshow.png", 
      new google.maps.Size(32, 37, "px", "px") 
      ), 
      }, 
      events: { 
      mouseup: function(marker, event, context) { 
       //// GETS MARKER LATITUDE AND LONGITUDE 
       var thePos = marker.getPosition(); 
       var theLat = thePos.jb; 
       var theLng = thePos.kb; 
       jQuery('#latitude').val(theLat); 
       jQuery('#longitude').val(theLng); 
      }, 
      dragend: function(marker, event, context) { 
       var thePos = marker.getPosition(); 
       //console.log(thePos); 
       var theLati = thePos.ob; 
       var theLngi = thePos.pb; 
       jQuery('#latitude').val(theLati); 
       jQuery('#longitude').val(theLngi); 

      jQuery(this).gmap3({ 
       getaddress:{ 
       latLng:marker.getPosition(), 
       callback:function(results){ 
        var map = $(this).gmap3("get"), 
        infowindow = $(this).gmap3({get:"infowindow"}), 
        content = results && results[1] ? results && results[1].formatted_address : "no address"; 

        if (infowindow){ 
        infowindow.open(map, marker); 
        infowindow.setContent(content); 
        } else { 
        jQuery(this).gmap3({ 
        infowindow:{ 
        anchor:marker, 
        options:{content: content} 
        } 
       }); 
       } 
      } 
      } 
     }); 

      }, 

     } 
     } 
    }); 
     } else { 
     alert('Could not find the latitude and longitude for the address '+the_address); 
       } 
     }); 
    }); 
}); 

Вчера он работает нормально. Но когда я проверил сегодня карту он показал мне ошибку в консоли вкладке светлячок, как этот

NetworkError: 403 Forbidden - http://maps.googleapis.com/maps/api/js/QuotaService.RecordEvent? 

Может кто-то любезно сказать мне, Что вопрос здесь? Любая помощь и предложения будут очень заметны. Благодаря

ответ

0

Я не уверен, что это причина, но есть проблема с кодом:

var theLat = thePos.jb; 
var theLng = thePos.kb; 

и

var theLati = thePos.ob; 
var theLngi = thePos.pb; 

вы пытаетесь получить доступ свойства LatLngs (jb, kb, ob, pb), которые внутренне используются API, имена этих свойств могут измениться.

Используйте методы lat() и lng() получить широту и долготу:

var theLat = thePos.lat(); 
var theLng = thePos.lng(); 

и

var theLati = thePos.lat(); 
var theLngi = thePos.lng(); 
+0

Я просто попробовал свой код ... но его вообще не работает .. У меня такая же ошибка. , – NewUser

3

ооо .. я делаю неправильно. Я загрузил код карты google на свой локальный сервер и давал ссылку на загруженные файлы. Это была проблема. Я просто удалил этот файл и сделал прямую ссылку на код карты google, и я получил свою работу с картой наконец ...

 Смежные вопросы

  • Нет связанных вопросов^_^