Forum: Ruby on Rails AJAX, Response codes and Opera.

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.
Jeff J. (Guest)
on 2006-04-19 19:46
Hello all.

I am in the following situation. I page made up of a few divs and a form
using
form_remote_tag like so:

<%= form_remote_tag :update => { :failure => 'content', :success =>
'body' }, :url => { :controller => 'server', :action => 'create',
:client_id => params[:client_id] } -%>
<%= render :partial => 'form' -%>
<%= end_form_tag -%>

As you can see depending on the success or failure two different divs
are updated. The backend code has this line.

  def create
    @server = Server.new(params[:server])
    @server.client_id = params[:client_id]
    if @server.save
      flash[:notice] = 'Server was successfully created.'
      flash[:partial] = true
      redirect_to :controller => 'client', :action => 'view', :client_id
=> params[:client_id]
    else
      render :partial => 'new', :client_id => params[:client_id],
:status => 403
    end
  end

Probably very un-rubyish but what the hell, I'm a noob. As you can see
what will happen is that if the submission is successful then the body
div will be updated with the content in the client/view action. If it
fails then the form partial is re-rendered in the content tag with a 403
HTTP code. (Which tells the the javascript that it should use that).

This works fine and dandy in Opera and firefox but in opera it isn't
working. The content div is updated with nothing. (I am using a
Javascript DOM analyser).
If I replace the :status with 200 then the partial fragment is rendered
in the body, if I use 201 it screws up. It looks like Opera isn't
rendering the response body if the HTTP code is anything other than 200.

Am I doing something wrong here or have others noticed this behaviour?

Thanks

Jeff
Jeff J. (Guest)
on 2006-04-19 19:48
eugh:

>This works fine and dandy in Opera and firefox but in opera it isn't

should read as

>This works fine and dandy in Internet Explorer and firefox but in Opera it isn't.
This topic is locked and can not be replied to.