Topic: AJAX ok, but when JavaScript is disable...

Hi!
Situation:
I have a form_remote_tag which is ended with submit_tag. There is a table with a number of rows inside. Action in this form updates all lines.
In row, the right most cell contains a link_to_remote 'Delete' (:url,...etc,:href).
Everything works perfectly when JavaScript is available or not.
But...
Here rise one problem. Everybody know, that for security reason with actions like delete, we always need request as 'post'.
When JavaScript is on, we are happy, but when JavaScript is off then :method => :post not works.
I've tried change link_to_remote on submit_to_remote but options :html seems not works (Firefox). This mean when JS is on is ok, when is off, not happen.
I couldn't resolve this problem with another helpers like button_to_function or remote_function.
We must to remember that we are inside the form.
Questions:
How can we achieve request always as post?
Can we talk about degrade server-side without resolve this problem, is any point in it ?
How many percent of users have browsers where JavaScript is off ? Is this problem still important nowadays ?
Any suggestions?

Last edited by walde (2007-09-18 02:24:30)

Re: AJAX ok, but when JavaScript is disable...

I set up a new route for a get delete

, :member => { :delete => :get }

so if you call

model/1;delete

you will get a "confirm deletion" with a proper html form to the destroy action

I also use this as a dialog popup called via ajax and submitted via ajax, but if javascript is off it renders the confirmation as a new page.

(as a note, I'm using the jquery lib, so no link_to_remote calls. I am using the methods describe here: http://mad.ly/2007/05/17/jquery-ajax-rails/ which make for perfect degrading links and forms)