title: ExtJS AJAX save as dialog box
body: <p>I make an ExtJS AJAX request and I want the standard browser 'save as' dialog box to be displayed to the user. The file to download can be a pdf, jpg or png file.</p>
  
  <p>At the moment the AJAX request is successfully submitted but as it's asynchronous no dialog box comes up.</p>
  
  <p>I could simply not use AJAX but there is a lot of javascript code that I need to use prior to making the request and I don't really feel rewriting it to java.</p>
  
  <p>My code looks like this:</p>
  
  <pre><code>var params = getPrintInfo(form);
  
  Ext.Ajax.request({
      url : 'print',
      method : 'POST',
      params : {
        customData: params.customData,
        dpi: params.dpi,
        format: params.format,
        grid: params.grid,
        title: params.title
      },
  autoAbort : false,
      success : function(result, request) {
        if(result.responseText==''){
          //display error message
        }else{
          // display save as dialog box
        }
      }
  });
  </code></pre>
  
  <p>In my controller I'm setting the headers to be:</p>
  
  <pre><code>httpResponse.setHeader("Content-disposition", "attachment; filename=" +  this.config.getString("print.file.name")+outputType);
  </code></pre>
  
  <p>EDIT:</p>
  
  <p>Have actually found this solution: </p>
  
  <pre><code>Ext.DomHelper.append(document.body, {
      tag: 'iframe',
      frameBorder: 0,
      width: 0,
      height: 0,
      css: 'display:none;visibility:hidden;height:1px;',
      src: 'http://blabla.com/f75e927b-2041-473e-86ba-cbbc60dbc285.pdf'
  });
  </code></pre>
  
  <p>Now the question is: How can I change the pdf name to be pretier, for example map.pdf instead of having that long ugly alphanumeric string? </p>