Manish Nautiyal
2012-Feb-29 09:07 UTC
how to use link_to with :remote=>true in rails 3.2.1
I m using Rails 3.2.1. how to use link_to with remote=>true -------------------------------------------- My Method in Controller def clickme @clk = "you click me" respond_to do |format| format.js { render :layout=>false } end end -------------------------------------------- My View In my new.html.erb file <%= link_to "click here", {:action=>"clickme"}, {:remote => true, :id=>"clk"} %> <div id="allclick"> <%= render :partial => ''goclick'' %> </div> -------------------------------------------- _goclick.html.erb <%= @clk %> -------------------------------------------- clickme.js.erb $("allclick").update("<%= escape_javascript(render(:partial => "goclick")) %>"); -------------------------------------------- On my web-page everything is fine when I click on click here link nothing change. But when I check Firebug console it shows me: $("allclick").update("you click me"); -------------------------------------------- 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.
Tim Shaffer
2012-Feb-29 13:13 UTC
Re: how to use link_to with :remote=>true in rails 3.2.1
You probably want to use $("#allclick").update instead of $("allclick").update Note the # that indicates you are selecting an element by the ID. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To view this discussion on the web visit https://groups.google.com/d/msg/rubyonrails-talk/-/vwmay5y73OwJ. 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
2012-Feb-29 13:18 UTC
Re: how to use link_to with :remote=>true in rails 3.2.1
Tim Shaffer wrote in post #1049440:> You probably want to use $("#allclick").update instead of > $("allclick").update > > Note the # that indicates you are selecting an element by the ID.I''m using $("#allclick").update -- 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.
Manish Nautiyal
2012-Mar-01 07:09 UTC
Re: how to use link_to with :remote=>true in rails 3.2.1
after doing some googling I got the answer wrong way : $("#allclick").update("<%= escape_javascript(render(:partial => "goclick")) %>"); ===================================================================correct way : $("#allclick").html("<%= escape_javascript(render(:partial => "goclick")) %>"); ===================================================================Instead of update now I''m using html -- 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.
Walter Lee Davis
2012-Mar-01 13:38 UTC
Re: Re: how to use link_to with :remote=>true in rails 3.2.1
On Mar 1, 2012, at 2:09 AM, Manish Nautiyal wrote:> after doing some googling I got the answer > > wrong way : > $("#allclick").update("<%= escape_javascript(render(:partial => > "goclick")) %>"); > > ===================================================================> correct way : > $("#allclick").html("<%= escape_javascript(render(:partial => > "goclick")) %>"); > > ===================================================================> Instead of update now I''m using html >Update would work perfectly if you were using Prototype.js instead of jQuery. Walter -- 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.