Tuesday, May 22, 2012

Re: [Rails] paramater passing with ajax in rails

Hey!

Can you be a little clearer about what you are trying to accomplish?

On Wed, May 23, 2012 at 11:48 AM, amvis <vgrkrishnan@gmail.com> wrote:
view.html 
  
<%= submit_tag "act",:id => params[:id], :class => "actcpn btn btn-success" %>

.js

$(".actcpn").click(function() {
$.ajax({
type: "PUT",
success: function(){
$('.nplabel').fadeIn(300).show();
$('.nplabel').fadeOut(3000);
}
});
});

class PgmControlller
def activate 
   @coupon_id = params[:id]
end
Here the problem is i need to get the params[:id] in controller. so when the act button click in view, that will call the ajax through class .actcpn, where i give the url to the controller,How to pass that button id via that ajax url to controller?

Thanks 
vishnu

--
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/-/2gzWsZv8J0UJ.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.



--
- Aziz M. Bookwala

--
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@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.

0 Comments:

Post a Comment

Subscribe to Post Comments [Atom]

<< Home


Real Estate