title: jquery DataTables plugin: can you capture server-side data other than the JSON expected by the plugin?
body: <p>I'm using "bServerSide": true, "sAjaxSource":, and "fnServerData":... to populate the datatable. This is working fine. </p>
  
  <pre><code> "bFilter": true,
  "bSort": true, 
  "bSortClasses": true, 
  "bProcessing": true,
  "bServerSide": true,
  "sAjaxSource": "my_page_that_outputs_json.asp",
  
  "fnServerData": function ( sSource, aoData, fnCallback ) {
      aoData.push( { "name": "my_custom_var"  , "value": $('#someCustomVar').val() } );                   
      $.getJSON( sSource, aoData, function (json) { 
          fnCallback(json);  
      } );
  },
  </code></pre>
  
  <p>However, when I make the call to the server, I want to return more than just the JSON from the page connecting to the server. I have additional recordsets I'd like to return with just the one call to the database, but is this possible within the datatables framework? The page outputting the JSON, when retrieved by the datatable, is only expecting the JSON, and gives an error when any other elements are present.  </p>
  
  <p><strong>Update 1:</strong> don't know if this is a proper route to take, 
  but I'm thinking now that one options would be to use datatables 
  hidden column feature. <a href="http://www.datatables.net/examples/basic_init/hidden_columns.html" rel="nofollow">http://www.datatables.net/examples/basic_init/hidden_columns.html</a>
  I suppose you could stuff elements with ID's in a single cell in the hidden column, 
  and then access the ID's info via jQuery. </p>
  
  <p><strong>Update 2:</strong> Maybe this is how the other elements on the parent page can 
  be updated from elements in the JSON response page (I've also posed this 
  issue in the datatables forum, with no response): </p>
  
  <ol>
  <li><p>add  and include ID's for each hidden input
  in the first row of json data</p></li>
  <li><p>don't try hidden columns, because elements seem to be inaccessible 
  when the column is hidden. (if I'm wrong about this, someone please inform...)</p></li>
  <li><p>if the hidden input only needs to be rendered once, then do so</p></li>
  <li><p>access the hidden input via jQuery on the parent page</p></li>
  </ol>
  
  <p><strong>Update 3:</strong>  @JM4 - I don't know that this will specifically address your question, 
  but I was able to use the hidden input route - e.g.,<code>&lt;input type="hidden id="myCustomID_012" /&gt;</code> - and get done what I needed to do. </p>
  
  <p>I used a function similar to the following to handle the row click. 
  This function was outside of the dataTable build. </p>
  
  <pre><code>function clickRowHandler() {
  /* Highlight selected row on single click */
  $('.tblIntrepid tbody tr').click(function(event) {
      $(oTable.fnSettings().aoData).each(function (){
          $(this.nTr).removeClass('row_selected');
      });
  
      // update the myIntrepidID value for form "complete" submission
              // myIntrepidID was already on the page, not in the dataTable
      var myNewIntrepidID = $(this).find("td:first input").val(); 
      $('#myIntrepidID').val(myNewIntrepidID); 
      // set the row class
      $(event.target.parentNode).toggleClass('row_selected');
      });
     /* more details */
    }
  </code></pre>
  
  <p>Inside the dataTable build, the clickRowHandler function was called in 
  this manner: </p>
  
  <pre><code>"fnDrawCallback": function() {
          clickRowHandler();
  },
  </code></pre>
  
  <p>Also, I can't remember where I saw this in the DataTables forum
  (probably started here: <a href="http://datatables.net/forums/comments.php?DiscussionID=3931" rel="nofollow">http://datatables.net/forums/comments.php?DiscussionID=3931</a>) 
  but another route you can use is to output json data above-and-beyond 
  what dataTables requires. So, while you need to output json that includes
  "sEcho" and "iTotalRecords" and "iTotalDisplayRecords" and "aaData", 
  you can also make your own name/value pairs. </p>
  
  <p>If you had a list of 10 usernames you wanted in a select dropdown
  in the table header, you could build a name/value pair in the place
  you build your json, and call it "selectUserNames". Then in your 
  dataTables build, you would turn that custom json object into your list
  (I'm not displaying all of the functions here):</p>
  
  <p>This function, outside of the dataTables build, creates the select dropdown. 
  //  <a href="http://datatables.net/forums/comments.php?DiscussionID=3931&amp;page=1#Item_6" rel="nofollow">http://datatables.net/forums/comments.php?DiscussionID=3931&amp;page=1#Item_6</a></p>
  
  <pre><code>function fnCreateSelect( aData ) {
      var r='&lt;select&gt;&lt;option value=""&gt;&lt;/option&gt;', i, iLen=aData.length;
      //alert(iLen); 
      for ( i=0 ; i&lt;iLen ; i++ )
      {
          r += '&lt;option value="'+aData[i]+'"&gt;'+aData[i]+'&lt;/option&gt;';
      }
      return r+'&lt;/select&gt;';
  }
  </code></pre>
  
  <p>And inside the dataTables build...</p>
  
  <pre><code>  $.getJSON( sSource, aoData, function (json) { 
       if ( json.sEcho == 1 ) {
          $("thead td.search").each( function () {
  
  /* Insert the select menu */
  this.innerHTML = fnCreateSelect(json.selectUserNames);
  
  /* Add the event listener for the newly created element */
     $('select', this).change( function () {
       oTable.fnFilter( $(this).val(), 8 );
     });
  });
  </code></pre>