I have a problem:
- I placed markers on a map
- I filter data and want to place part of these markers => I send json to server
-
I get response, delete all markers and try to place new markers, but my gmap has gray color and nothing appears.
here is some piece of code:var pins; function processFilterResult(data) { pins = data; var myLatlng = new google.maps.LatLng(pins[0].gpsLocationN, pins[0].gpsLocationW); var myOptions = { zoom : 7, center : myLatlng, mapTypeId : google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); for(var i=0; i<pins.length; i++) { pins[i] = createMarkers(new google.maps.LatLng(pins[i].gpsLocationN,pins[i].gpsLocationW), pins[i]); } } function initializeGMap() { pins = convertToJSON($("#someId")); var myLatlng = new google.maps.LatLng(pins[0].gpsLocationN, pins[0].gpsLocationW); var myOptions = { zoom : 7, center : myLatlng, mapTypeId : google.maps.MapTypeId.ROADMAP }; map = new google.maps.Map(document.getElementById("map_canvas"), myOptions); for(var i=0; i<pins.length; i++) { pins[i] = createMarkers(new google.maps.LatLng(pins[i].gpsLocationN,pins[i].gpsLocationW), pins[i]); } google.maps.event.addListener(map, 'click', function(event) { });}
clear markers:
function clearOverlays() {
for (var i = 0; i < pins.length; i++ ) {
pins[i].setMap(null);
}
pins = new Array();
}
filtering:
$.post(
"/mediabook/owner/filterMaps.json",
a,
function(data) {
clearOverlays();
processFilterResult(data);
});
I’m not clear your entire code though, I think your code should be like this: