When I try and use rjs rails just outputs the text of the javascript I
am trying to call with page.call
javascript is enabled, I have tried setting
config.action_view.debug_rjs to false and commenting it out in the
development environment. I have created a new app with no other
javascript libraries and just tried to use rjs to call a simple
javascript function. I have the include defaults tag in the layout.
what is this pre thing, and why won't it just call the javascript.
This is killing me either there is some configuration everyone knows
about that isn't posted anywhere or I haven't come across a tutorial
that shows it or this is a bug in rails. Please help
trying
def index
@images = Image.find(:all)
render :update do |page|
page << ' <SCRIPT type="text/javascript">'
page.call 'myfunction', 'pics\test1.jpeg'
page << ' </script>'
end
#render :index
end
have tried redirecting to an action with the render stuff, the page
still only has that <pre> thing in the body.
I heard that it wasn't, and the thing to make the compatible was to
replae the $ in moo tools with something else so that symbol wouldn't
conflict, I tried that. I also created an empty app that did not have
moo tools in it, just to try and call a javascript function with rjs,
and it keeps on printiong out the text of what it should be making
call as a function.
I know prototype is being used since it parses in the try{.. catch
(rjs error stuff, just don't know why it doesn't actually execute the
code
You don't need that <SCRIPT type="text/javascript">. the thing that parses the response knows that it's javascript to evaluate, so you're asking the javascript interpreter to evaluate
<SCRIPT type="text/javascript">
which it can't since that's not legal javascript (you can see this from what firebug shows you).
Remove the two page << (and make sure that when you use link_to_remote you aren't using the :update option) and you should be ok.