Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

312
Views
El mapa de Google borra los marcadores antiguos... ¿cuándo hay nuevos marcadores?

Cómo eliminar el marcador antiguo y luego establecer el nuevo marcador de intervalo... Estoy llamando a una API y trazando nuevos marcadores después de unos segundos de setinterval. Los nuevos marcadores se trazan, pero el anterior aún permanece. Quiero borrar el marcador anterior cuando se trazan los nuevos marcadores. Aquí está mi código.

 window.setInterval(selectLocation, 1000); var map,mIcon; function initMap() { var myOptions = { zoom: 17, center: new google.maps.LatLng(18.803535629803218, 98.95209518731684), mapTypeId:google.maps.MapTypeId.ROADMAP }; mIcon = { path: google.maps.SymbolPath.CIRCLE, fillColor: "green", fillOpacity: 0.8, strokeOpacity: 0.5, strokeWeight: 6, strokeColor: '#1b7709', scale: 30 }; map = new google.maps.Map(document.getElementById('map_canvas'), myOptions); infowindow = new google.maps.InfoWindow({ map:map, }); } let json; let marker = []; function selectLocation(){ $.ajax({ type:"POST", url: "json_location.php", }).done(function(text){ json = $.parseJSON(text); for(var i = 0 ;i<json.length;i++){ var lat = json[i].lat; var lng = json[i].lng; var id_local = json[i].id_local; var name_local = json[i].name_local; var latlng = new google.maps.LatLng(lat,lng); var id = i; marker = new google.maps.Marker({ map:map, html:id, position:latlng, icon: mIcon, label: {color: '#FFF', fontSize: '14px', fontWeight: '600', text: json[i].id_local}, title: json[i].id_local, }) }) }
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!