Trying to use RJS, raw Try(my javascript) catch is displayed on page

def index     redirect_to(:action => 'test')   end

  def test     render :update do |page|       page << ' <SCRIPT type="text/javascript">'       page.call 'myfunction', 'pics\test1.jpeg'       page << ' </script>'     end   end

mozilla just displayes the following, my function is defined in the layout and my goal is just to call this javascript function when this page is loaded, don't know how why this won't work, this is just basic stuff.

try { <SCRIPT type="text/javascript"> myfunction("pics\\test1.jpeg"); </script> } catch (e) { alert('RJS error:\n\n' + e.toString()); alert(' <SCRIPT type=\"text/javascript\">\nmyfunction(\"pics\\\\test1.jpeg\");\n </

sweiss wrote:

def index

Did you remember to use the javascript_include tags, and do you have javascript enabled for that particular browser..

ilan

yep javascript is enabled, and the head of my rhtml template looks like such

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "DTD/xhtml1- strict.dtd"> <html xml:lang="en" xmlns="http://www.w3.org/1999/xhtml&quot; lang="en">   <head profile="http://gmpg.org/xfn/11&quot;&gt;     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />     <title>Your title</title>     <script type="text/javascript" src="mootools.js"></script>     <script type="text/javascript" src="croppr.js"></script>     <%= javascript_include_tag :defaults %>     <%= active_scaffold_includes %>     <link rel="stylesheet" type="text/css" href="main.css"/>     <script type="text/javascript">       function myfunction(src)       {

how is the remote method 'test' getting called from the view.

Do not include an :update parameter, otherwise the view is expecting a simple render such as render :text=>'Replaced with this' and wont understand the render :update response block.

Tonypm