Hi All, I'm fairly new to Rails, having jumped into it at my new web dev job. I've been assigned the task of converting an existing website from the regular RoR/Prototype setup over to jQuery in order to develop unobtrusive ajax enhancements.

My first todo is to ajaxify the contact form. I've followed the jquery Railscast:

1. copy jquery.js to /public/javascripts and call javascript_include_tag 'jquery' in my application layout.

2. used the jquery.ajaxSetup method to setup the request headers as text/javascript so that rails will execute format.js in the respond_to block.

In my controller I do a respond_to block and this is where i'm getting stuck. I can't find the syntax to be able to render a javascript partial from any views folder i wan't.

In the railscast, he simply calls format.js without arguments inside the respond_to block, which in turn renders a [controller method name].js.erb file within the views/[controller] folder.

My question is how do i call any partial from any views folder i want?

Im in the send_mail method of my contact_controller, and my desired javascript file is in views/widgets/contact.js.erb.

In the respond_to block i'm trying this:

Code Ruby:
format.js { render :partial => 'widgets/contact'
I have a simple alert('wtf') call in that partial but it never executes.

The form submit action is correctly intercepted by my widget.js file that's included on the page already and it works fine.

The page also works as intended with javascript disabled.

So to sum up, how do I render any javascript partial after the ajax call from the respond_to block?