I use v3 google map api, but when I click the marker on the map I see the following error message :
b.K is not a function
(72 out of range 43)
here's my code :
var markers = [];
var map;
var markerClusterer = null;
var load_ids = [];
var rectangle;
var infowindow = new google.maps.InfoWindow();
function showAddress(xaddress,xzoom) {
clearOverlays(); $("#div_item_list").html(""); $('#map_canvas2').gMap({ address: xaddress, zoom:xzoom, onComplete: function() { //marker from address geocoder = new google.maps.Geocoder(); geocoder.geocode({'address': xaddress}, function(results, status) { if (status == google.maps.GeocoderStatus.OK) { map.gMap('addMarker', { key: 'mainMarker', latitude: results[0].geometry.location.lat(), longitude: results[0].geometry.location.lng(), popup: true }); >map_search(results[0].geometry.location.lat(),results[0].geometry.location.lng()); map.data('gmap').gmap.setCenter(results[0].geometry.location); //clearOverlays(); } else { alert("Geocoder failed due to: " + status); } }); } }); return false;
}
function clearOverlays() {
if (markers) { for (i in markers) { markers[i].setMap(null); } } if(markerClusterer){ markerClusterer.clearMarkers(); }
}
function map_search(lat,lon) {
$("#div_item_list").html('<img src="images/loader.gif"/>'); $.ajax({ url: "search/map/find_item", type: "POST", dataType: "json", data: "lat="+lat+"&lon="+lon, success: function(msg){ if (msg.length > 0) { //add marker on gmap markers = []; $.each(msg, function(item) { load_ids.push(msg[item]['id_item']); html_data = '<b>' + msg[item]['code'] + ' ('+ msg[item]['case_transtype'] +')</b><br/>' + 'Address: ' + msg[item]['address_name']; var marker = createMarker(msg[item]['id_item'],markers,msg[item]['lat'],msg[item]['lon'],html_data); markers.push(marker); }); markerClusterer = new MarkerClusterer(map.data('gmap').gmap, markers); load_grid2(lat,lon); load_listener(); } else { $("#div_item_list").html("Empty"); } } });//end ajax
}
function createMarker(object_id,markers,lat,lng,html_data) {
var _gicon = { image: 'images/item.png', iconSize: new google.maps.Size(32, 32), iconAnchor: new google.maps.Point(12, 46) }; gicon = new google.maps.MarkerImage(_gicon.image, _gicon.iconSize, null, _gicon.iconAnchor); var latLng = new google.maps.LatLng(lat,lng); var marker = new google.maps.Marker({ 'position': latLng, 'icon': gicon }); google.maps.event.addListener(marker, 'click', function(){ infowindow.close(); infowindow.setContent(html_data); infowindow.open(map,marker); //change screen $('#point_show_'+object_id).addClass("ui-state-hover"); $('#point_show_'+object_id).trigger("focus"); }); return marker;}
the error came up when script infowindow.open(map,marker);
is executed
for example you can check http://cremp.solusi247.com/eways/en/search/map/index/
, search using keyword 'Riyadh' on Address textbox. and click 1 house icon.