title: Server-side processing with pipelining
body: <p>By default this function works with <code>$_GET</code>. Based <a href="http://datatables.net/forums/discussion/691/pipeline-post/p1" rel="nofollow">on this discussion</a> I modified <a href="http://datatables.net/release-datatables/examples/server_side/pipeline.html" rel="nofollow">this function</a> and got something like below. Now the problem is, Firebug gives error message</p>
  
  <blockquote>
    <p>json.aaData is undefined @ line 99</p>
  </blockquote>
  
  <p>Here is line (located at the end of code) :</p>
  
  <pre><code>json.aaData.splice( 0, iRequestStart-oCache.iCacheLower ); 
  </code></pre>
  
  <p>PHP side responds, and this table works 100% without pipelining. But When I enable pipelining getting this error:</p>
  
  <p><a href="http://screencast.com/t/GOJzPHq3kg" rel="nofollow">http://screencast.com/t/GOJzPHq3kg</a></p>
  
  <pre><code>function fnDataTablesPipeline ( sSource, aoData, fnCallback ) {
      var iPipe = 5; /* Ajust the pipe size */
  
      var bNeedServer = false;
      var sEcho = fnGetKey(aoData, "sEcho");
      var iRequestStart = fnGetKey(aoData, "iDisplayStart");
      var iRequestLength = fnGetKey(aoData, "iDisplayLength");
      var iRequestEnd = iRequestStart + iRequestLength;
      oCache.iDisplayStart = iRequestStart;
  
      /* outside pipeline? */
      if ( oCache.iCacheLower &lt; 0 || iRequestStart &lt; oCache.iCacheLower || iRequestEnd &gt; oCache.iCacheUpper )
      {
          bNeedServer = true;
      }
  
      /* sorting etc changed? */
      if ( oCache.lastRequest &amp;&amp; !bNeedServer )
      {
          for( var i=0, iLen=aoData.length ; i&lt;iLen ; i++ )
          {
              if ( aoData[i].name != "iDisplayStart" &amp;&amp; aoData[i].name != "iDisplayLength" &amp;&amp; aoData[i].name != "sEcho" )
              {
                  if ( aoData[i].value != oCache.lastRequest[i].value )
                  {
                      bNeedServer = true;
                      break;
                  }
              }
          }
      }
  
      /* Store the request for checking next time around */
      oCache.lastRequest = aoData.slice();
  
      if ( bNeedServer )
      {
          if ( iRequestStart &lt; oCache.iCacheLower )
          {
              iRequestStart = iRequestStart - (iRequestLength*(iPipe-1));
              if ( iRequestStart &lt; 0 )
              {
                  iRequestStart = 0;
              }
          }
  
          oCache.iCacheLower = iRequestStart;
          oCache.iCacheUpper = iRequestStart + (iRequestLength * iPipe);
          oCache.iDisplayLength = fnGetKey( aoData, "iDisplayLength" );
          fnSetKey( aoData, "iDisplayStart", iRequestStart );
          fnSetKey( aoData, "iDisplayLength", iRequestLength*iPipe );
  
          jQuery.post( sSource, aoData, function (data) { 
              /* Callback processing */
              oCache.lastJson = jQuery.extend(true, {}, data);
  
              if ( oCache.iCacheLower != oCache.iDisplayStart )
              {
                  data.aaData.splice( 0, oCache.iDisplayStart-oCache.iCacheLower );
              }
              data.aaData.splice( oCache.iDisplayLength, data.aaData.length );
  
              fnCallback(data)
          },"json" );
      }
      else
      {
          json = jQuery.extend(true, {}, oCache.lastJson);
          json.sEcho = sEcho; /* Update the echo for each response */
          json.aaData.splice( 0, iRequestStart-oCache.iCacheLower ); // &lt;- this line
          json.aaData.splice( iRequestLength, json.aaData.length );
          fnCallback(json);
          return;
      }
  }
  </code></pre>
  
  <p>What am I missing? Any suggestion?</p>