AJAX request

I’m having a bit of problem with my remote responses …

I’ve got this link:

<%= link_to_remote(_("_add"),
:url => {:controller => ‘versions’, :action => ‘new’, :project =>
@project, :id => @document},
:loading => “Element.show(‘loader’)”,
:complete => evaluate_remote_response) %>

which calls this rjs file:

page[‘version_form’].replace_html :partial => “new”
page.visual_effect :slide_down, :version_form, :duration => 0.2
page[‘loader’].hide

where the partial, ‘new’ is a form.

This works fine in safari and firefox but I just can’t get it working in
ie (6&7). I’ve even tried commenting out the first 2 lines of the rjs
file so that it reads:

page[‘loader’].hide

and nothing else but nope. My loader just stays on.

Any ideas?

Oh and Happy New Year by the way!

Regards

Adam

Some additional info:

For some reason, the above works in IE 6 & 7 when I replace the .rjs
with an inline rjs in the controller action.

And to make matters more confusing, I created a test rails app with
similar code to the above and … it works in IE!

So this must be something specific to my application.

Any ideas?

Adam G. wrote:

Some additional info:

For some reason, the above works in IE 6 & 7 when I replace the .rjs
with an inline rjs in the controller action.

And to make matters more confusing, I created a test rails app with
similar code to the above and … it works in IE!

So this must be something specific to my application.

Any ideas?

So you’ve confirmed that the action gets hit (since the inline RJS
works) ?

Firebug installed in Firefox would at least allow you to see whats was
coming fdown the pipe.

Removing the evaluiate_response and dumping the response text in an
alert box might let you see the javascript in IE.

Alan

Thanks for the reply Alan.

I think that with rjs, the :complete bit in a link_to_remote is
superflous now. At least, it works without it. And changing to :complete
=> “alert(request.responseText)” doesn’t alter anything: it still
executes in Safari & FF (and not in IE).

I’ve got firebug and that shows everything to be working as it should.
The only thing I can think of is that for some reason, the response text
from my rjs templates is not being interpretted by IE (poss wrong
content type?).

I’ve also got this in my rhtml template for debugging purposes. In
Safari and FF, it shows the request url and response text, but in IE it
just shows the url.

I’m confused …

In case anyone’s interested - problem solved!

I’ve been developing this app for over a year now and forgot about this
little before filter:

def configure_charsets
@headers[“Content-Type”] = “text/html; charset=utf8”
end

Whoops!

Thanks anyway Alan for replying.

I just said that firebug was showing everything to be ok but I checked
the HEADERS tab in console and what do you know? … the content-type
is text/html! In my test app, it’s text/javascript. Bizarre!

Adam G. wrote:

In case anyone’s interested - problem solved!

I’ve been developing this app for over a year now and forgot about this
little before filter:

def configure_charsets
@headers[“Content-Type”] = “text/html; charset=utf8”
end

Whoops!

Thanks anyway Alan for replying.

:slight_smile:

Glad you got it sorted out. It still seems odd to me though, that you
didn’t get the alert in IE. Even if it was being send with text/html,
I’d have thought it wouldn’t evalutae_response, but it would have
displayed the javascript.

Weird.

A.