How to pass javascript variables to a method

Hello,

I’m trying to pass a record’s ID, latitude, and longitude from
javascript variables to a method in my controller. I keep getting an
Application Error and I don’t know why. Here’s what I have in my
javascript code:

<% @rID = capture do %>id<% end %>
<% @rLAT = capture do %>place.Point.coordinates[1]<% end %>
<% @rLONG = capture do %>place.Point.coordinates[0]<% end %>
<%= updatecoordinates(@rID, @rLAT, @rLONG) %>

On the controller end, I have the following:

def updatecoordinates(id, lat, long)
Bookstore.update(id, {:latitude => lat, :longitude=> long})
end

Any help would be greatly appreciated.

Thanks,
Chris W.

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs