hi to all, i''ve this javascript function : function km(str_dir) { map = new GMap2(document.getElementById("map_canvas")); directionsPanel = document.getElementById("route"); directions = new GDirections(map, directionsPanel); directions.load(str_dir); GEvent.addListener(directions,"load", function() { var dist= directions.getDistance().meters; return dist; }); } i call the function from the controller in this way: @arg="500 Memorial Drive, Cambridge, MA to Fenway Park, Boston, MA" page.call ("km", @arg) all work... the problem is that i want to take the result of javascript function in the controller... How can i use the variable "dist" inside the controller?? thanks in advance andre -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Andrea Campagna wrote:> hi to all, > > i''ve this javascript function : > > function km(str_dir) { > map = new GMap2(document.getElementById("map_canvas")); > directionsPanel = document.getElementById("route");You gotta send request to your controller/method using Ajax, that is the only way i could think of :) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---
Jamal Soueidan wrote:> Andrea Campagna wrote: >> hi to all, >> >> i''ve this javascript function : >> >> function km(str_dir) { >> map = new GMap2(document.getElementById("map_canvas")); >> directionsPanel = document.getElementById("route"); > > You gotta send request to your controller/method using Ajax, that is the > only way i could think of :)thanks i think i have to learn a little bit ajax :) -- Posted via http://www.ruby-forum.com/. --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en -~----------~----~----~----~------~----~------~--~---