Ajax.Request with page reload?

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

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?

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 D.

Iplan Networks Datos Personales
[email protected] [email protected]
www.iplan.com.ar www.rorra.com.ar
5031-6303 15-5695-6027

-----Mensaje original-----
De: [email protected]
[mailto:[email protected]] En nombre de Brian
Cardarella
Enviado el: Viernes, 23 de Junio de 2006 01:53 p.m.
Para: [email protected]
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
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails

Brian C. 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

Hi Brian,

On Fri, 23 Jun 2006 18:53:04 +0200, Brian C. 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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs