Good day, I would like to ask on how to solve the problem regarding RJS on a javascritpt disabled browsers. because when i disable the javascript on my firefox and click on the submit button what i get is the javascript. Is there a way that if javascript is disabled the user will be redirected to the erb file? Thank you
on 2008-07-08 10:25
on 2008-07-08 10:46
On 8.7.2008, at 11.24, skilled_dreamer wrote: > > Good day, > > I would like to ask on how to solve the problem regarding RJS on a > javascritpt disabled browsers. because when i disable the javascript > on my firefox and click on the submit button what i get is the > javascript. > > Is there a way that if javascript is disabled the user will be > redirected to the erb file? I don't think you should get the RJS in return if the request is sent from a non-JS context, given that you have an existing normal html template for that action. If you get the RJS back, the action either for some reason thinks that you want to get javascript back or doesn't have anything else to return. //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi
on 2008-07-08 17:15
This list is being phased out, you should move your JS questions to the new list here: http://groups.google.com/group/prototype-scriptaculous To your question, this isn't really a JavaScript related question as it deals with the server responding to different content types. You should look into RESTful style coding practices, wikipedia: http://en.wikipedia.org/wiki/Representational_State_Transfer But basically, in Rails, it is dealing with different content types within a single action, such as: def show respond_to do |wants| wants.html do # HTML response goes here end wants.js do render :update do |page| page.alert "hello from javascript" end end end
on 2008-07-08 18:04
On 8.7.2008, at 18.14, Justin Perkins wrote: > But basically, in Rails, it is dealing with different content types > within a single action, such as: > > def show > ... > end Although, in Rails 2.1, the correct template type is rendered automatically, so you don't necessary need to use respond_to anymore, unless need some more complex logic in the controller action. //jarkko -- Jarkko Laine http://jlaine.net http://dotherightthing.com http://www.railsecommerce.com http://odesign.fi