Thursday, May 24, 2012

[Rails] Re: paramater passing with ajax in rails

amvis wrote in post #1061789:
> On Wednesday, 23 May 2012 02:32:59 UTC-4, azizmb.in wrote:
> *header.js*
> *
> *
> $("*.actcpn*").click(function() {
> $.ajax({
> type: "PUT",
> url: "http://localhost:3000/pgms/cpn_activate/",
> success: function(){
> $('.nplabel').fadeIn(300).show();
> $('.nplabel').fadeOut(3000);
> }
> });
> });
> ...
> So how to pass that button ID via the url from the ajax..?

You pass the parameter the same way you always do with HTTP. Put it in
the query string or request body. JQuery makes this easy using the
"data" attribute:

$.ajax({
type: 'PUT',
url: url,
data: data,
success: success,
dataType: dataType
});

data - A map or string that is sent to the server with the request.

--
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@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