title: Adding callback to jquery .submit() to read error responses from uploads
body: <p>I've got an iframe #uploadTarget which I'm using for image uploads:</p>
  
  <pre><code>function uploadImage(){
  
      if ($('#imageUploader').val().length &gt; 0){
          $('#uploadingIndicator').show();
  
          // set form params such that it uploads image
          $('#uploadForm').attr("action", uploadUrl);
          $('#uploadForm').attr("enctype", "multipart/form-data");
          $('#uploadForm').attr("target", 'uploadTarget');
  
          // submit for image upload
          $('#uploadForm').submit();
          resetFormAttributes();
  
          //console.log($('#uploadTarget').contents().find('body').text());
  
      } else {
          resetFormAttributes();
          $('#uploadForm').submit();
      }
  }
  </code></pre>
  
  <p>When image upload is done, the page inside the iframe executes javascript which calls doneUploading outside the iframe. </p>
  
  <p>In the event where the file is too big or an error occurred and an error page is displayed in the iframe, the doneUpload function is not called.</p>
  
  <p>Is it possible to have some sort of a callback function that triggers after $('#uploadForm').submit() completed (in which case I'll read the page for error responses)?</p>
  
  <p>If not, how would I read error responses being returned inside the iframe?</p>