Alert Original Error Msg In AJAX

Alert Original Error Msg In AJAX

harrisonleeharrisonlee Posts: 1Questions: 1Answers: 0
edited September 2021 in DataTables 1.10

I have config as below:

    $.fn.dataTable.ext.errMode = 'none';
    
    $('#example')
            .on( 'error.dt', function ( e, settings, techNote, message ) {
                console.log(message);
            } )
            .DataTable();

The ajax result is

    {
    ...
    data: null,
    error: 'Parameter Not Right'
    ...
    }

However The message example is:
DataTables warning: table id=zdataTable - Parameter Not Right
My goal is to alert the original error mesage in ajax without "DataTables warning: table id=zdataTable -" profix. Is there any path to do that?

Edited by Allan - Syntax highlighting. Details on how to highlight code using markdown can be found in this guide.

This question has an accepted answers - jump to answer

Answers

  • allanallan Posts: 61,446Questions: 1Answers: 10,054 Site admin
    Answer ✓

    I'm afraid not - the prefix is always added. At the moment the only option would be to split the string on ; (for example) in your error handling function and display the second half.

    Allan

Sign In or Register to comment.