Skip to main content
We’ve updated our Terms of Service. A new AI Addendum clarifies how Stack Overflow utilizes AI interactions.
3 events
when toggle format what by license comment
May 8, 2013 at 1:02 comment added Lai Yu-Hsuan I mean to write <div id="foo" data-lat="<%= @user.lat %>"></div> in your .html.erb file. JavaScript can access HTML attributes, so them can be used to pass data between Ruby and JavaScript.
May 8, 2013 at 0:50 comment added CHarris Do you mean just define <div id="foo" data-lat="<%= @user.lat %>"></div> in my js file, then map_latitude = $("#foo").data("lat");, and then use the variable map_latitude in my google maps function?
May 8, 2013 at 0:43 history answered Lai Yu-Hsuan CC BY-SA 3.0