Proper syntax for withCredentials?

Proper syntax for withCredentials?

jnedzeljnedzel Posts: 28Questions: 4Answers: 0

What is the proper format for setting:

    xhrFields: {
        withCredentials: false
    },

I'm currently creating my table using this format:

       oTable.dataTable({
            "deferRender": true,
            "bDestroy": true,
            "bRetrieve": true,
            "bJQueryUI": true,
            "bProcessing": true,
            "sPaginationType": "full_numbers",
            "sAjaxSource": url,
            "sAjaxDataProp": dataProp,
            "aoColumns": columnProps,
            "sDom": 'T<"clear">lfrtip',
            "tableTools": tableToolsProps,
            "oLanguage": {
                "sEmptyTable": "Please wait - Fetching records"
            },...

I need to set withCredentials: false to solve some CORS issues. Sorry for the formatting, I can't figure out how to get markdown to preserve linebreaks in a code block.

Answers

  • allanallan Posts: 63,498Questions: 1Answers: 10,471 Site admin

    Use ajax in 1.10 rather than the old style sAjaxSource option. The newer ajax provides the option to be given as an object which extends the jQuery Ajax options.

    Allan

  • jnedzeljnedzel Posts: 28Questions: 4Answers: 0

    Unfortunately, the last time I looked at the new syntax I found it non-trivial to make the change. That is just not an option for us at this point.

    I will use direct Ajax calls to retrieve the data, as I can set the no-credentials flags on the jQuery Ajax calls. Then I will feed those objects to DataTables. That is a lot more doable than learning (and debugging) the new syntax.

This discussion has been closed.