-
-
Save cluhring/af3124788462547aabc1 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
class WelcomeController < ApplicationController | |
respond_to :html, :json | |
def index | |
@coordinates = {} | |
@coordinates[:latitude] = 39.749813 | |
@coordinates[:longitude] = -104.999717 | |
# @coordinates = "#{latitude}, #{longitude}" | |
respond_with @coordinates | |
end | |
end | |
for the marker: | |
// put jQuery or ajax | |
$.get('welcome.json', function(welcomeData) { | |
// welcomeData.forEach(function(welcome) { | |
// make a new LatLng object | |
var latlng = new google.maps.LatLng(welcomeData.latitude, welcomeData.longitude); | |
// make a new Marker object | |
var marker = new google.maps.Marker({ | |
position: latlng, | |
map: map, | |
// }); | |
}); | |
// place the marker on the map | |
marker.setMap(map); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment