Sunday, 15 January 2012

ruby on rails - Redirect user to external url with post method and params -


How do I redirect the user to a URL through a post user? I know redirect_to only get works for requests How can you get it?

You can assign a POST to a user. You can submit a user with a link which will change the Rail Js in a form / post:

  = link_to "do it!", "Http: // more Site / path ", Method :: Post  

... or a form triggering a POST on another site (note that I have an additional Paragraph is included) e.g.

  = form_tag "http://other.site/path", Method :: post do = hidden_field_tag: foo, "bar" = submit_tag "Do it!"  

... or you can request on behalf of your user (here I am using the gem), note that I am the same Foo = bar Parameter:

  Class YourController & lt; In the ApplicationController, HTTParty def some_action self.class.post "http://other.site/path", query: {foo: "bar"} and end  

some options for you


No comments:

Post a Comment