Forum: Ruby on Rails Automatic save

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Jesper Andersen (Guest)
on 2006-06-14 11:32
(Received via mailing list)
I have a page where people might be writing information for a long time.
So I want a feature like autosave.
I have used PeriodicalExecuter and Ajax.Request to submit the form
regularly. That part is working fine.
I also made a link_to_remote that calls a show method and updates with
information from the database.  The show method uses respond_to to see
if
it should return javascript or html. That part is working fine.

The problem is that I want the save command to be automatically followed
by the show to update the information. So in the save method I redirect
to the show method. The show method gets called after the save, but
apparently the X-Requested-With header is not set in this redirected
request so the show method returns html with the result that no update
happens in the client. If I then press the update link_to_remote the
update happens correctly.

Is that an error to do a redirect this way or is there a problem with
the
X-Requested-With header?
This topic is locked and can not be replied to.