I need to send a POST request via a link, along with paramater data for an action, and the page needs to reload. link_to_remote worked great when I was updating a DOM element but obviously won''t work when I need to reload a page. Is there an option -- Posted via http://www.ruby-forum.com/.
hit return by mistake.... I need to send a POST request via a link, along with paramater data for an action, and the page needs to reload. link_to_remote worked great when I was updating a DOM element but obviously won''t work when I need to reload a page. Is there an option to force Ajax.request (link_to_remote) to reload the page? -- Posted via http://www.ruby-forum.com/.
I thought that ajax is to send and receive data asynchronously from a server, without reloading the page, and optionally updating some parts of the current page by using DOM. I wouldn''t use ajax to reload the page, instead I would use javascript, doing somethink like this: var parameters = ''var1=hello&var2='' + $F(''myTextField''); windows.location = ''http://mypage.com.ar/mycontroler'' + parameters; Rodrigo Dominguez ? Iplan Networks ???????????????Datos Personales rdominguez@iplan.com.ar ??????rorra@rorra.com.ar www.iplan.com.ar ?????????????www.rorra.com.ar 5031-6303 ????????????????????15-5695-6027 -----Mensaje original----- De: rails-bounces@lists.rubyonrails.org [mailto:rails-bounces@lists.rubyonrails.org] En nombre de Brian Cardarella Enviado el: Viernes, 23 de Junio de 2006 01:53 p.m. Para: rails@lists.rubyonrails.org Asunto: [Rails] Re: Ajax.Request with page reload? hit return by mistake.... I need to send a POST request via a link, along with paramater data for an action, and the page needs to reload. link_to_remote worked great when I was updating a DOM element but obviously won''t work when I need to reload a page. Is there an option to force Ajax.request (link_to_remote) to reload the page? -- Posted via http://www.ruby-forum.com/. _______________________________________________ Rails mailing list Rails@lists.rubyonrails.org http://lists.rubyonrails.org/mailman/listinfo/rails
Brian Cardarella wrote:> hit return by mistake.... > > > I need to send a POST request via a link, along with paramater data for > an action, and the page needs to reload. link_to_remote worked great > when I was updating a DOM element but obviously won''t work when I need > to reload a page. Is there an option to force Ajax.request > (link_to_remote) to reload the page?Using RJS it''s easy: page.redirect_to(some_url(:id => ''foo'')) Or if you''re not using RJS templates, you can embed RJS in your link to remote tag: link_to_remote(:url => (some_url), :complete => render(:update) {|page| page.redirect_to(some_url)} ) Or if you''re don''t want to use RJS at all, I believe you can just use the javascript equivalent window.location.href = ''/some_url/foo/1''; // Not completely sure of the above syntax but // its something like that -- Posted via http://www.ruby-forum.com/.
Hi Brian, On Fri, 23 Jun 2006 18:53:04 +0200, Brian Cardarella wrote:> hit return by mistake.... > > > I need to send a POST request via a link, along with paramater data for > an action, and the page needs to reload. link_to_remote worked great > when I was updating a DOM element but obviously won''t work when I need > to reload a page. Is there an option to force Ajax.request > (link_to_remote) to reload the page?It sounds to me like you don''t want AJAX at all.. just submit like a normal form which has a redirect_to in the controller? Trent