# Degrading to same URL

**URL:** <https://www.ruby-forum.com/t/degrading-to-same-url/72507>\
**Category:** Rails\
**Created:** [October 17, 2006, 6:39pm UTC](https://www.ruby-forum.com/t/degrading-to-same-url/72507 "2006-10-17T18:39:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![zanoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@zanoni](https://www.ruby-forum.com/u/zanoni)\
**Post date:** [October 17, 2006, 6:39pm UTC](https://www.ruby-forum.com/t/degrading-to-same-url/72507/1 "2006-10-17T18:39:38Z")

</div>

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 -  
[Codecite.com is for sale | HugeDomains](http://codecite.com/presentation/ruby/rails/ajax_rails#22))  
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 ?

Stuart

–

> **[Dark ambient](https://en.wikipedia.org/wiki/Dark_ambient)**
>
> Dark ambient (referred to as ambient industrial especially in the 1980s) is a genre of post-industrial music that features an ominous, dark droning and often gloomy, monumental or catacombal atmosphere, partially with discordant overtones. It shows similarities with ambient music, a genre that has been cited as a main influence by many dark ambient artists, both conceptually and compositionally. Although mostly electronically generated, dark ambient also includes the sampling of hand-pla 
> The te...

---

<div class="post-metadata">

**Author:** ![zanoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@zanoni](https://www.ruby-forum.com/u/zanoni)\
**Post date:** [October 17, 2006, 6:47pm UTC](https://www.ruby-forum.com/t/degrading-to-same-url/72507/2 "2006-10-17T18:47:40Z")

</div>

On Oct 17, 12:36 pm, “Dark A.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> If JS is turned off, does using the form with the observe\_form code intefere  
> in any way ?
> 
> Stuart
> 
> –[Dark ambient - Wikipedia](http://en.wikipedia.org/wiki/Dark_ambient)

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?

\_Kevin

---

<div class="post-metadata">

**Author:** ![zanoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@zanoni](https://www.ruby-forum.com/u/zanoni)\
**Post date:** [October 17, 2006, 7:29pm UTC](https://www.ruby-forum.com/t/degrading-to-same-url/72507/3 "2006-10-17T19:29:47Z")

</div>

On 10/17/06, \_Kevin [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > the request goes into the same controller (makes sense so far)
> 
> Is this what you are trying to do?
> 
> \_Kevin

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.

Stuart

–

> **[Dark ambient](https://en.wikipedia.org/wiki/Dark_ambient)**
>
> Dark ambient (referred to as ambient industrial especially in the 1980s) is a genre of post-industrial music that features an ominous, dark droning and often gloomy, monumental or catacombal atmosphere, partially with discordant overtones. It shows similarities with ambient music, a genre that has been cited as a main influence by many dark ambient artists, both conceptually and compositionally. Although mostly electronically generated, dark ambient also includes the sampling of hand-pla 
> The te...

---

<div class="post-metadata">

**Author:** ![zanoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@zanoni](https://www.ruby-forum.com/u/zanoni)\
**Post date:** [October 17, 2006, 7:55pm UTC](https://www.ruby-forum.com/t/degrading-to-same-url/72507/4 "2006-10-17T19:55:56Z")

</div>

On Oct 17, 1:26 pm, “Dark A.” [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > It looks like (looking at a slide -  
> > > intefere  
> > > to a new page, while an ajax request would render an RJS template and  
> > > –[Dark ambient - Wikipedia](http://en.wikipedia.org/wiki/Dark_ambient)  
> > > 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.

\_Kevin

---

<div class="post-metadata">

**Author:** ![zanoni](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/z/e99b99/32.png) [@zanoni](https://www.ruby-forum.com/u/zanoni)\
**Post date:** [October 17, 2006, 8:48pm UTC](https://www.ruby-forum.com/t/degrading-to-same-url/72507/5 "2006-10-17T20:48:11Z")

</div>

On 10/17/06, \_Kevin [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > > place)
> > 
> > –[Dark ambient - Wikipedia](http://en.wikipedia.org/wiki/Dark_ambient)
> 
> 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 ?

Stuart

–

> **[Dark ambient](https://en.wikipedia.org/wiki/Dark_ambient)**
>
> Dark ambient (referred to as ambient industrial especially in the 1980s) is a genre of post-industrial music that features an ominous, dark droning and often gloomy, monumental or catacombal atmosphere, partially with discordant overtones. It shows similarities with ambient music, a genre that has been cited as a main influence by many dark ambient artists, both conceptually and compositionally. Although mostly electronically generated, dark ambient also includes the sampling of hand-pla 
> The te...
