title: How to target form to iframe with Ajax?
body: <p>I'm still newbe to jQuery so I can't figure out everything on my own. I have simple <code>form</code> for uploading images, jQuery plugin for <code>progress bar</code> which I styled in terms of material design, and <code>iFrame</code> with uploaded files. The thing is, I cannot target that form to iframe, it somehow stops, I assume a conflict in code.</p>
  
  <p>This is HTML:</p>
  
  <pre><code>&lt;form action="upload-sys.php" class="upload" enctype="multipart/form-data" method="post" target="galleryframe"&gt;
       &lt;input class="chooseimg" id="fileToUpload" name="fileToUpload" type="file" /&gt; 
       &lt;input name="submit" type="submit" value="UPLOAD" /&gt;&amp;nbsp;
  &lt;/form&gt;
  
  &lt;div class="progress"&gt;
      &lt;div class="bar"&gt;
           &amp;nbsp;&lt;/div&gt;
  &lt;/div&gt;
  
  &lt;iframe name="galleryframe" onload="javascript:resizeIframe(this);" src="gallery-sys.php"&gt;&lt;/iframe&gt;
  </code></pre>
  
  <p>jQuery:</p>
  
  <pre><code>&lt;script src="http://malsup.github.com/jquery.form.js"&gt;&lt;/script&gt;
  &lt;script&gt;
  (function() {
      var bar = $('.bar');
      $('form').ajaxForm({
          beforeSend: function() {
              var percentVal = '0%';
              bar.width(percentVal)
          },
          uploadProgress: function(event, position, total, percentComplete) {
              var percentVal = percentComplete + '%';
              bar.width(percentVal)
          }
      }); 
  })();                   
  &lt;/script&gt;
  </code></pre>
  
  <p>I don't understand why it doesn't send data to iframe. Then I could reload just iframe source with php and show new images immediately.</p>
  
  <p>I found out I can redirect whole page (but obviously that's not what I need) with adding this:</p>
  
  <pre><code>complete: function() {
      window.location.href = "url-of-target-page";
  }
  </code></pre>
  
  <p>I also tried:</p>
  
  <pre><code>complete: function(responseText, statusText) {
       target.html(responseText);
       var target = 'galleryframe';
  }
  </code></pre>
  
  <p>but no luck.</p>
  
  <p>Could anyone guide me on this one?</p>