Move link_to data from URL to body

Hi guys,

I'm having a a link_to element which sends data to the server. This is currently encoded in the URL. Is it possible to move this URI encoded data to the body, in order to have a clean URL?

Thank you in advance!

Kind regards, Martin

If you are literally 'sending data to the server' then generally this should be sent using a POST, so the data will not be in the url.

Colin

I'm having the following link_to

link_to 'Close Discussion', blog_discussion_path(@blog, @note, note: { state_transaction: :close }, only_status: true), method: :put

The parameters state_transaction and only_status are encoded within the query. This is is what I want to hide/remove.

Colin Law wrote in post #1154239:

If you are literally 'sending data to the server' then generally this should be sent using a POST, so the data will not be in the url.

You mean changing the method to method: post and add another route?

Martin

Use a form rather than a link. You can use hidden fields to set the parameters, with only the submit link visible if that is what you want.

Colin

A form is not possible, because it's going to a different controller. That's the reason I'm using link_to

Please quote relevant parts of the previous message so that individual messages make sense. This is a mailing list, not a forum, though you may be accessing it via a forum-like interface.

You can make a form submit to any controller you like. You can specify the controller action with form_for by using the :url option. Or you can just use form_tag.

Colin