Trying to do server side processing with ajax & ReST.

Trying to do server side processing with ajax & ReST.

rkushnerrkushner Posts: 1Questions: 1Answers: 0

The error says 'data' is undefined. The debugger says HTML1506: Uexpected token. It was working when the ajax function called the DataTable function on success. Here's the code:

    dataTableExample = $('#table_id').DataTable({
        "processing": true,
        "serverSide": true,
        "ajax":{ 
            url: oDataUrl,
            type: "GET",
            dataType: "json",
            headers: {
                "accept": "application/json;odata=verbose"}
        },
        "order": [[ 7, "desc" ]],
        "aaData": data.d.results,
        "aoColumns": [{
            "mData": "ID",
            "render": function(mData) {
            return("<a href='"+_spPageContextInfo.webAbsoluteUrl+"/Lists/ExternalUserAccounts/ExtendExpiry.aspx?itemid=" + mData + "' class='edit-entry'><img src='../../SiteAssets/images/edit.png'></a>");
            }
        }, {
            "mData": "Title"

Answers

  • kthorngrenkthorngren Posts: 21,362Questions: 26Answers: 4,956

    HTML1506: Unexpected token

    That suggests to me that a syntax error was found while parsing the HTML page. Have you run the page through an HTML syntax checker?

    Kevin

  • allanallan Posts: 63,552Questions: 1Answers: 10,477 Site admin

    Why are you setting both ajax and data (the new form for the legacy aaData option)? They are either / or. To be honest, it doesn't really make sense to set them both together - you would either get the data from Ajax or from a local Javascript variable.

    Allan

This discussion has been closed.