title: Export datagrid to excel using Jquery Easyui
body: <p>I am new in json. I generated jason data from mysql table using php and want to export the generated json to .xls format.</p>
  
  <p>examexport.php</p>
  
  <pre><code>&lt;?php
      include 'conn.php';
  
      $page = isset($_POST['page']) ? intval($_POST['page']) : 1;
      $rows = isset($_POST['rows']) ? intval($_POST['rows']) : 10;
      $semester = isset($_POST['semester']) ? 
      mysql_real_escape_string($_POST['semester']) : '';
      $entry = isset($_POST['entry']) ? mysql_real_escape_string($_POST['entry']) : '';
      $batch = isset($_POST['batch']) ? mysql_real_escape_string($_POST['batch']) : '';
  
      //phpexcel things go here
  ?&gt;
  </code></pre>
  
  <p>My php generated json:</p>
  
  <pre><code> {"total":"6","rows":
   [{"id":"2","regd":"25","name":"Lalhmangaihsangi","class":"BA",
  "rollno":"3","univ_roll":"UNVI573","univ_no":"MZU876","core":"Education",
  "semester":"First","batch":"2014","subject":"Education",
  "entry":"Second Internal Test","date":"2014-07-23",
  "score":"55","fm":"100","remark":"She is guarded"}]}
  </code></pre>
  
  <p>Code for export to excel:</p>
  
  <pre><code>&lt;input type="button" onclick="exportExcel()" value="Export to Excel " /&gt;
  &lt;script&gt;                
    function exportExcel(){
      $('#dg').datagrid('load',{ //load data by semester/batch/entry
      semester: $('#semester').val(),
      batch: $('#batch').val(),
      entry: $('#entry').val(),
      document.location='excel/examexport.php'// How do I include entry/batch/ here?
   });
   }
  &lt;/script&gt;
  </code></pre>
  
  <p>I want to send something like document.location='excel/examexport.php?entry=entry&amp;batch=batch&amp;semester=semester'
  I got a ReferenceError exportExcel is not defined.</p>