I followed the gmaps4rails gem and I was able to reload the marker using the setinterval function. The problem I am facing is after each interval when the card goes back to the original, i.e. if I am enlarged, it returns to normal.
This is the code
success: (data, jqxhr, status) -> console.log('data.bookings', data) $('#multi_markers').removeClass('hidden') $('.empty_booking_text').removeClass('hidden') $('#sidebar_container').html('Please click any booking marker on the map') markers_from_api = data.bookings handler = Gmaps.build('Google') settings = { internal: { id: 'multi_markers' }, provider:{ styles: mapStyles } } handler.buildMap settings, -> markers = handler.addMarkers(markers_from_api) _.each markers,(marker, j) -> google.maps.event.addListener marker.serviceObject, 'click', (object) -> console.log marker.serviceObject.position.lng() render_marker_data markers_from_api[j].id return handler.bounds.extendWith markers handler.fitMapToBounds() setInterval () -> $ -> update_marker_data(handler) , 10000
refresh marker every 10 seconds
update_marker_data = (handler) -> markers = [] $.ajax '/technician_locations/current_location', type: 'GET' success: (data, jqxhr, status) ->
source share