Send a POST off a link, not a button

Hi,

Got a question about how the book suggests sending POST requests using a
form whenever one intents to change some database state. So I converted
a
bunch of links to forms which ended up creating buttons. I was
wondering if
there was a way to keep them links rather than buttons but still use
POST in
a form?

thanks.

Am 10.05.2006 um 00:11 schrieb Sam D.:

Hi,

Got a question about how the book suggests sending POST requests
using a form whenever one intents to change some database state.
So I converted a bunch of links to forms which ended up creating
buttons. I was wondering if there was a way to keep them links
rather than buttons but still use POST in a form?

Call a JavaScript that does an XmlHttpRequest (aka AJAX request)
which is submitted via POST.

*m

Sam D. wrote:

Hi,

Got a question about how the book suggests sending POST requests using
a form whenever one intents to change some database state. So I
converted a bunch of links to forms which ended up creating buttons.
I was wondering if there was a way to keep them links rather than
buttons but still use POST in a form?
Try link_to(“Destroy!”, {:action => ‘destroy’}, :post => true).

This will automagically create the javascript to turn the link in to a
POST method.

Manuel H. <purestorm@…> writes:

rather than buttons but still use POST in a form?

Call a JavaScript that does an XmlHttpRequest (aka AJAX request)
which is submitted via POST.

*m

Or easier, your link should look like this:

Link Name

This submits the first form on the page. You can also specify forms by
name or
id I think, but you typically only have one form per page anyway.