title: jquery-jtable: exporting selected lines using ajax/jsp
body: <p>I need to implement an export to Excel function, but only for selected lines of the jtable, in a JSP environment.</p>
  
  <p>My question is: what is the best way to do it? From the jtable, I pick the $('#SearchResultTable').jtable('selectedRows') and post it (using jquery $.post() ) to my servlet (that is generating the Excel file using poi). Everything good until I have to pick up the response from the servlet. Turns out I cannot save it to disk or prompt the browser to download it, since ajax is basically javascript, and thus have no access to the disk.</p>
  
  <p>Is there a better way to do this? I want to be able to name and save the resulting file.</p>
  
  <p>This is my call function which handles the post:</p>
  
  <pre><code>toolbar: {
      items: [{
          icon: 'art/excel_ico.gif',
          text: 'Esporta in Excel',
          display: 'download="Report.xls"',
          click: function() {
              return $.post("ExcelExport", {n: "Magazzino", t: $('#SelectedRowList')[0].innerHTML})
              .done(function(data) {
                  alert("Data Loaded: " + data);
              });
          }
      }]
  },
  </code></pre>
  
  <p>Thank you for your help,
  Fabio.</p>