Created
January 15, 2012 08:41
-
-
Save nysalor/1615095 to your computer and use it in GitHub Desktop.
gmaps4rails:getposition and replace markers
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@get_current_position = () => | |
navigator.geolocation.getCurrentPosition @nearby_places, @failed_alert | |
@nearby_places = (position) => | |
res = $.getJSON "/places/nearby.json", { lat: position.coords.latitude, long: position.coords.longitude }, | |
(json) -> | |
Gmaps.map.replaceMarkers json | |
@failed_alert = () => | |
alert "failed to get current position." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment