Degrading to same URL

I hope this comes out clearly -
I think I want to try and degrade to the same URL (Ajax vs non-Ajax)

It looks like (looking at a slide -
the request goes into the same controller (makes sense so far)
then the same partial gets called (here is where some confusion takes place)

If JS is turned off , then I suppose the partial (the form) must have a submit button. I guess I can also do some type of dom id thing where if js is on button not there and if off, button there ?

If JS is turned off, does using the form with the observe_form code intefere in any way ?


You can use 'responds_to' or just 'request.xhr?' to see if the request
is a post, get, or ajax call and then respond accordingly.

For example, if a submit was sent via a post, you could then redirect
to a new page, while an ajax request would render an RJS template and
update the original page.

Is this what you are trying to do?


Yes, that is the goal. However, right now my ajaxed form has no submit button, it has an observe_form in it. So not sure if that will work , as far as using the same form. This is my quandry.


So, if I follow you correctly, you want to use the AJAX methods unless
JS is turned off. In that case you want it to degrade to a standard
form with a submit button?

One way to do this would be to let the page render with a button and
then use AJAX or JS to remove the button. If no JS or AJAX, then it
will stay there.


So until the button is pressed there is no way of knowing that the browser is JS enabled ?