nephish
2010-Sep-22 18:21 UTC
how to remote function to get info from url in a javascript function
hey all I am working with a javascript function called Elabel, part of the Google maps api the Elabel has a function called setContents(html) i need to be able to call this function and get new html for it. ( the html is a table that displays weather data) here is what i have so far function replace_weather_table(){ zoomy = map.getZoom(); weather_table_one.setContents(new Ajax.Request(''/weather/ update_weather_tables?zoom=''+zoomy)); }; GEvent.addListener(map,"moveend", replace_weather_table); i would like to have the contents be those of a partial, but when executed, the display only shows "[object Object]" would appreciate any help, thanks sk -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
radhames brito
2010-Sep-22 20:15 UTC
Re: how to remote function to get info from url in a javascript function
make a controller respond to ajax and return a .js.erb it will be evaluated dynamically. -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
radhames brito
2010-Sep-22 20:23 UTC
Re: how to remote function to get info from url in a javascript function
load jquery first and perform a $.get([controller_path], null, null,''script'') return a whatever.js.erb with a content like $("#thingy").html("<%=escape_javascript(render :partial =>"controller/whatever")%>"); -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Marnen Laibow-Koser
2010-Sep-23 14:25 UTC
Re: how to remote function to get info from url in a javascript function
Shawn Bright wrote:> hey all > > I am working with a javascript function called Elabel, part of the > Google maps api > the Elabel has a function called setContents(html) > > i need to be able to call this function and get new html for it. ( the > html is a table that displays weather data)I don''t understand your logic flow. Can you clarify?> > here is what i have so far > > > function replace_weather_table(){ > zoomy = map.getZoom(); > weather_table_one.setContents(new Ajax.Request(''/weather/ > update_weather_tables?zoom=''+zoomy)); > }; > > GEvent.addListener(map,"moveend", replace_weather_table); > > i would like to have the contents be those of a partial, but when > executed, the display only shows "[object Object]"Is the new HTML rendered by your Rails app, then, or does it come from a remote server?> > would appreciate any help, thanks > > skBest, -- Marnen Laibow-Koser http://www.marnen.org marnen-sbuyVjPbboAdnm+yROfE0A@public.gmane.org -- 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-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Maybe Matching Threads
- Using a *supported* web cam under CentOS 5
- xtable feature addition suggestion
- map not displayed after Ajax.updater request
- [mapstraction commit] r12 - Implemented most Cloudmade functions. Still requires image, tile and KML/GeoRSS overlays
- Prototype Window Class v0.70