Google Map API marker not removeSTsoftware Team7yAsked Jan 18, 2019, 8:32 PM EST4 answersShareLinkedInXCopy linkSaveHello, I am using google map api first time loading map completed but auto refresh working done but old marker not remove , marker.setmap(null) not working
Google Map API marker not removeSTsoftware Team7yAsked Jan 18, 2019, 8:32 PM EST4 answersShareLinkedInXCopy linkSaveHello, I am using google map api first time loading map completed but auto refresh working done but old marker not remove , marker.setmap(null) not working
Jenith ThakkarRank #789 · 2.9K reputation7y agoPosted Jan 19, 2019, 12:15 AM EST0you need to also set marker object nullLike below marker.setMap(null);marker=null; only this will not work marker.setMap(null); 0STsoftware Team21 reputation7y agoPosted Jan 19, 2019, 12:28 AM EST0Dear, Not resolved var marker = new google.maps.Marker({}); //var googleMarkers = []; setInterval(function () { var markersicon = "../images/male.svg"; var url = "/Home/ZoneDetails_new"; marker.setMap(null); marker = null; $.getJSON(url, null, function (data) { var pins = []; $.each(data, function (index, LocationData) { var myLatlng = new google.maps.LatLng(LocationData.DEVICE_LATITUDE, LocationData.DEVICE_LONGITUDE); marker = new google.maps.Marker({ position: myLatlng, map: map, icon: markersicon }); //googleMarkers.push(marker); (function (marker) { google.maps.event.addListener(marker, "mouseover", function (e) { infoWindow.setContent(LocationData.Title); infoWindow.open(map, marker); }); google.maps.event.addListener(marker, 'mouseout', function () { infoWindow.close(); }); })(marker); }); }); }, 10000) 0Jenith ThakkarRank #789 · 2.9K reputation7y agoPosted Jan 19, 2019, 12:44 AM EST0Might be this both lines are working on page load whenever Auto refresh has done that time this compiler not reached to this lines marker.setMap(null);marker = null; please set debugger and check is it launch when auto refresh done0STsoftware Team21 reputation7y agoPosted Jan 19, 2019, 1:16 AM EST0Dear, Not resolved 0Join to answer this questionEvery answer you publish earns 20 SHARP.Create free accountSign inKnow the answer?Answer a question in the forums and earn +20 SHARP for every answer.See unanswered questionsForumsTop experts01Arun PottiAnswers in the forums20answers02Tahir AnsariAnswers in the forums5answers03Kamlesh KumarAnswers in the forums5answers04Sam HobbsAnswers in the forums4answers05Željko PerićAnswers in the forums3answers?YouYour name goes here.Every answer: 20 SHARP.JoinFull leaderboard →2026DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
STsoftware Team21 reputation7y agoPosted Jan 19, 2019, 12:28 AM EST0Dear, Not resolved var marker = new google.maps.Marker({}); //var googleMarkers = []; setInterval(function () { var markersicon = "../images/male.svg"; var url = "/Home/ZoneDetails_new"; marker.setMap(null); marker = null; $.getJSON(url, null, function (data) { var pins = []; $.each(data, function (index, LocationData) { var myLatlng = new google.maps.LatLng(LocationData.DEVICE_LATITUDE, LocationData.DEVICE_LONGITUDE); marker = new google.maps.Marker({ position: myLatlng, map: map, icon: markersicon }); //googleMarkers.push(marker); (function (marker) { google.maps.event.addListener(marker, "mouseover", function (e) { infoWindow.setContent(LocationData.Title); infoWindow.open(map, marker); }); google.maps.event.addListener(marker, 'mouseout', function () { infoWindow.close(); }); })(marker); }); }); }, 10000) 0
Jenith ThakkarRank #789 · 2.9K reputation7y agoPosted Jan 19, 2019, 12:44 AM EST0Might be this both lines are working on page load whenever Auto refresh has done that time this compiler not reached to this lines marker.setMap(null);marker = null; please set debugger and check is it launch when auto refresh done0STsoftware Team21 reputation7y agoPosted Jan 19, 2019, 1:16 AM EST0Dear, Not resolved 0Join to answer this questionEvery answer you publish earns 20 SHARP.Create free accountSign inKnow the answer?Answer a question in the forums and earn +20 SHARP for every answer.See unanswered questionsForumsTop experts01Arun PottiAnswers in the forums20answers02Tahir AnsariAnswers in the forums5answers03Kamlesh KumarAnswers in the forums5answers04Sam HobbsAnswers in the forums4answers05Željko PerićAnswers in the forums3answers?YouYour name goes here.Every answer: 20 SHARP.JoinFull leaderboard →2026DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Jenith ThakkarRank #789 · 2.9K reputationPosted Jan 19, 2019, 12:15 AM EST
software Team21 reputationPosted Jan 19, 2019, 12:28 AM EST
Jenith ThakkarRank #789 · 2.9K reputationPosted Jan 19, 2019, 12:44 AM EST
software Team21 reputationPosted Jan 19, 2019, 1:16 AM EST
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questionsTop experts