I’ve been joyfully using RJS in a lot of our work lately, with no issues
whatsoever. However, I am porting an application to RJS templates that
we’ve had for a while, and having some issues.
When I use Firebug to see what is going on, the response comes back like
this:
try {
new Effect.Highlight(“gi_error_row”,{duration:20});
} catch (e) { alert(‘RJS error:\n\n’ + e.toString()); alert(‘new
Effect.Highlight(“gi_error_row”,{duration:20});’); throw e }
I know from looking at my working apps with RJS that the response should
not be wrapped in a try/catch statement. Most of my googling has turned
up suggestions to make sure your rails project is up to date, but mine
is (1.1.2) and the javascripts have also been updated (prototype
1.5.0_rc0). It was updated via the rake rails:update command…
When I create a new app on my system to test out things, RJS works fine.
There must be some cruft from pre 1.1 rails in my project somewhere, but
where?
And I still get this as the response (again this is via Firebug, I get
no response whatsoever in the browser window):
try {
alert(“Hi”);
} catch (e) { alert(‘RJS error:\n\n’ + e.toString());
alert(‘alert(“Hi”);’); throw e }
But if I throw that very same code into a new project, everything works
as expected.
try turning that off and see if the ‘try’ goes away.
_Kevin
Yep, that takes away the try/catch stuff, and returns the correct JS
command. Still nothing in the browser, so obviously the scripts aren’t
being eval’ed. Here is the generated onclick event…
Ahhh…that led me in the right direction. I was using the utf lib and
had completely forgot about it setting the content-type. I took that
part out of the utf lib, and used the after filter as described in the
link above. Thanks all for helping me troubleshoot…