title: Problem using 'responds_to_parent' with an iframe and AJAX to upload a file
body: <p>I followed instructions from the "<a href="http://khamsouk.souvanlasy.com/articles/ajax-file-uploads-in-rails-using-attachment_fu-and-responds_to_parent" rel="nofollow">AJAX file uploads in Rails using attachment_fu and responds_to_parent</a>" article. In my case I am using Ruby on Rails 3 and Paperclip.</p>
  
  <p>What I made is the following:</p>
  
  <hr>
  
  <p>I have installed the 'respons_to_parent' plugin running this command in the Terminal:</p>
  
  <pre><code>rails plugin install git://github.com/itkin/respond_to_parent.git
  </code></pre>
  
  <p>After installing, I restart Apache.</p>
  
  <hr>
  
  <p>In my view I have:</p>
  
  <pre><code>&lt;%= form_for(@user, :html =&gt; { :multipart =&gt; true, :target =&gt; 'upload_frame' }) do |f| %&gt;
    &lt;%= f.file_field :avatar %&gt;
    &lt;%= f.submit "Submit" %&gt;
  &lt;% end %&gt;
  
  &lt;div id="test"&gt;Here is a test&lt;/div&gt;
  &lt;div id="stuff"&gt;Here is some stuff&lt;/div&gt;
  &lt;iframe id='upload_frame' name="upload_frame" style="width:1px;height:1px;border:0px" &gt;&lt;/iframe&gt;
  </code></pre>
  
  <hr>
  
  <p>In my controller I have</p>
  
  <pre><code>  def action
      respond_to do |format|
        ...
        format.js {
          responds_to_parent do
            render :update do |page|
              page.replace_html :test, "This is the resulting test"
              page &lt;&lt; "alert($('stuff').innerHTML)"
            end
          end
        end
      end
    end
  </code></pre>
  
  <hr>
  
  <p>Trying to submit the form, all about the file uploading works (Paperclip handle correclty files, ...) and in the log file there aren't errors.</p>
  
  <p>The <em>only</em> thing that isn't working is the AJAX part. In the example</p>
  
  <pre><code>page.replace_html :test, "This is the resulting test"
  page &lt;&lt; "alert($('stuff').innerHTML)"
  </code></pre>
  
  <p>don't update the page (BTW: where these should have effect? in the "main view" or in the "iframe view"?). It doesn't work also if I try to delete the 'respons_to_parent' statement or if I put them in the 'action.js.rjs' file.</p>
  
  <p><strong>Where I am wrong?</strong></p>