Convert GET to POST in JS

Work with datatables. Trying to get a work function (which currently works ONLY with GET) using POST.

Based on in this discussion, I changed this function and got something like below. Now we get the error message:

json.aaData undefined @line 99

Whole code here

        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 ); // <- this line
        json.aaData.splice( iRequestLength, json.aaData.length );
        fnCallback(json);
        return;
    }
}

What am I missing? Any suggestion?

+3
source share
2 answers

Thus, the full sample code you provided cannot be the complete code because it contains only 75 lines and you get an error message indicating that you have the undefined property on line 99.

However, you said that this line:

json.aaData.splice( 0, iRequestStart-oCache.iCacheLower );

undefined. , aaData, - json.

, JavaScript json.aaData, , undefined. , aaData json, . , .

0

jQuery.post( sSource, aoData, function (data) {. aoData, aaData. .

+1

All Articles