title: Serialize with javascript (jquery) to new window
body: <p>I’m trying to submit a form to with javascript (jquery) to another page that export the result to excel. Below is the code I use to send form data a page and return the results to a div on the same page.</p>
  
  <pre><code> &lt;script type="text/javascript"&gt;
   function get3() {
   $.post('chartprojecttype.php', 
   $('form[name="reportform"]').serialize(), 
   function (output) {
   $('#info').html(output).show();
   });
   }
   &lt;/script&gt;
  </code></pre>
  
  <p>I tried to modify it like this,</p>
  
  <pre><code> &lt;script type="text/javascript"&gt;
   function get4() {
   $.post('openticketsexcel.php', 
   {
   document.getElementById(‘reportform’).submit();
   });
   &lt;/script&gt;
  </code></pre>
  
  <p>But it does not work. I have another way to do this  and have to different pages that export it in different format.</p>
  
  <pre><code>  &lt;input type="image" name="excel" onclick="submitForm('openticketsexcel.php')" value="Export To Excel" src="../pix/excel.png" class="submit_button"&gt;&lt;input type="image" name="word" onclick="submitForm('openticketsword.php')" value="Export To Word" src="../pix/word.png"class="submit_button"&gt;
  </code></pre>
  
  <p>and</p>
  
  <pre><code> &lt;script type="text/javascript"&gt;
       function submitForm(action)
       {
           document.getElementById('reportform').action = action;
           document.getElementById('reportform').submit();
       }
   &lt;/script&gt;
  </code></pre>
  
  <p>This works but only in IE.  Chrome and FireFox can used the first code that returns the submitted data but not the code that submits it to the export pages. Any ideas?</p>