hi I wanna call rails method from the javascript method. It should be ajax call for rails method. please help me. -- 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.
read on link_to_remote and please be more specific On Mon, Sep 6, 2010 at 2:09 PM, Manish Nautiyal <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> hi > > I wanna call rails method from the javascript method. > > It should be ajax call for rails method. > > > please help me. > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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.
Manish Nautiyal
2010-Sep-07 09:48 UTC
Re: how to call rails method from javascript method.
radhames brito wrote:> read on link_to_remote > > > and please be more specificI am more specific now. There is one swf file. When I click on that swf file it will return user_id. And below that swf file I have to show detail of the specific users. The detail will come from database. Now the problem is that there is small javascript function which will give me the user id. So from that javascript function I wanna call rails method which will fetch data from database and show it where I want. -- 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.
radhames brito
2010-Sep-07 14:14 UTC
Re: Re: how to call rails method from javascript method.
call the action like "/controller_name/action_name.js" this from the javascript file, if the call is ajax make your controller respond to js then the file action_name.js is really named action_name.js.rb file there do <%=render :text => user.id%> this is what should happen, you call from the javascript "/controller_name/action_name.js", this goes to the route and matches map.connect /:controller/:action.:format you see the format at the end ? rails will return the action_name.js.rb ignoring the rb part as it does with index.html.rb that file will render the text with the user id, another option is returning a json object, read a bit about it because i think json is the way to go. On Tue, Sep 7, 2010 at 5:48 AM, Manish Nautiyal <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> radhames brito wrote: > > read on link_to_remote > > > > > > and please be more specific > > I am more specific now. > > There is one swf file. When I click on that swf file it will return > user_id. > And below that swf file I have to show detail of the specific users. The > detail will come from database. Now the problem is that there is small > javascript function which will give me the user id. So from that > javascript function I wanna call rails method which will fetch data from > database and show it where I want. > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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.
Manish Nautiyal
2010-Sep-09 06:06 UTC
Re: Re: how to call rails method from javascript method.
radhames brito wrote:> call the action like "/controller_name/action_name.js" this from the > javascript file, if the call is ajax make your controller respond to js > then the file action_name.js is really named action_name.js.rb file > there do > <%=render :text => user.id%> > > > this is what should happen, you call from the javascript > "/controller_name/action_name.js", this goes to the route and matches > > map.connect /:controller/:action.:format > > you see the format at the end ? rails will return the action_name.js.rb > ignoring the rb part as it does with index.html.rb that file will render > the > text with the user id, another option is returning a json object, read a > bit > about it because i think json is the way to go.Hi radhames brito again diturbing you. Please give me the link for this also. -- 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.
radhames brito
2010-Sep-09 11:14 UTC
Re: Re: Re: how to call rails method from javascript method.
ill give you a link where there is a example done for auto completion with jquery, but everything you are saying can be done with those technicks http://rwldesign.com/journals/1-solutions/posts/32-using-jquery-ui-autocomplete-with-rails it shows how to make ajax call and how to respond with json On Thu, Sep 9, 2010 at 2:06 AM, Manish Nautiyal <lists-fsXkhYbjdPsEEoCn2XhGlw@public.gmane.org>wrote:> radhames brito wrote: > > call the action like "/controller_name/action_name.js" this from the > > javascript file, if the call is ajax make your controller respond to js > > then the file action_name.js is really named action_name.js.rb file > > there do > > <%=render :text => user.id%> > > > > > > this is what should happen, you call from the javascript > > "/controller_name/action_name.js", this goes to the route and matches > > > > map.connect /:controller/:action.:format > > > > you see the format at the end ? rails will return the action_name.js.rb > > ignoring the rb part as it does with index.html.rb that file will render > > the > > text with the user id, another option is returning a json object, read a > > bit > > about it because i think json is the way to go. > > > > Hi radhames brito > > again diturbing you. Please give me the link for this also. > -- > 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-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org<rubyonrails-talk%2Bunsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org> > . > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- 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.
Reasonably Related Threads
- How to transform my html form into a rails 3 form
- Rails 3 - Creating a comment and then returning the Partial with JUST the new comment
- Rails 3 + jQuery ; How to show error messages
- RequireResourceHelper for JS and CSS
- how to do render partial on jquery ajax success method with rails 3