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
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
On 5 August 2014 08:18, Martin T. [email protected] wrote:
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?
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 L. 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
A form is not possible, because it’s going to a different controller.
That’s the reason I’m using link_to.
Martin
On 5 August 2014 09:13, Martin T. [email protected] wrote:
I’m having the following link_to
link_to ‘Close Discussion’, blog_discussion_path(@blog, @note, note: {
state_transaction: :close }, only_status: true), method: :putThe parameters state_transaction and only_status are encoded within the
query. This is is what I want to hide/remove.
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
On 5 August 2014 09:24, Martin T. [email protected] wrote:
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
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.
Sponsor our Newsletter | Privacy Policy | Terms of Service | Remote Ruby Jobs