Donate. I desperately need donations to survive due to my health

Get paid by answering surveys Click here

Click here to donate

Remote/Work from Home jobs

Error function is invoked in IE Compatible mode

I am new to Ajax. I am making ajax call and displaying that data into a table format. I have tested this code in all browser (Chrome, FireFox & IE). It is working as expected.
Issue: After We enable the Compatability mode in IE, sometimes table data is loading and sometimes is not loading. It automatically goes to an error function method.
Instead of displaying the table data, it is displaying the message 'Unable to load the data into the table.'
Sample Code
function loadTable(dataItem, container){
...      
...
$.ajax({
  url: "/modules/Demo/services/ReportData",
  type: "POST",
  traditional: true,
  data: {
            param1: param1Array,
            param2: calcArray,  
        },
        success: function (data) {
             $.ajax({
                url: "/modules/Demo/services/ChartData",
                type: "POST",
                traditional: true,
                data: {
                    des: emp,
                    quarter: third
                },
                success: function (data) {
                    genrateChart(data, container);
                },
                error: function () {
                    container.text("Error occure while populate the Chart.");
                }
             });

        },
        error: function () {
            container.text("Unable to load the data into table.");
        }
    });
}

<div class="reportData" id="displayData" style="margin-top:20px;">
</div>
I have added the below code to check the error log
error: function(jqXHR, textStatus, errorThrown) {       
$('#result').html('<p>status code: '+jqXHR.status+'</p><p>errorThrown: ' + errorThrown + '</p><p>jqXHR.responseText:</p><div>'+jqXHR.responseText + '</div>');
console.log('jqXHR:');
console.log(jqXHR);
console.log('textStatus:');
console.log(textStatus);
console.log('errorThrown:');
console.log(errorThrown);
}
Console Log content
jqXHR:
[object Object]{readyState: 4, responseText: "[  {"xyz ...", status: 200, statusText: "parsererror"}
[object Object]
 {
[functions]: ,
 readyState: 4,
 responseText: "[//It displaying application data that i should not share here
{
 status: 200,
 statusText: "parsererror"}
 textStatus:
parsererror
errorThrown:
[object Error]
 {
 message: "JSON.parse",
 name: "SyntaxError"
It seems, As per the log, It saying parseError which means unable to parse the data. I can't understand, sometimes it is working, sometimes it is not working.
Additional Analysis in Debug console - Response Body Section
We are parsing the data using the script. I have selected the date range from 2010 to 2018 in chrome ran the report. Press F12 & went to the network tab. The response body has the below data.
[
{"Salary":12345.25,"Employee Age Limit":"0-17","Joining type":"Immediate","Joining date":"2010-01-19"},
{"Salary":24567.25,"Employee Age Limit":"0-20","Joining type":"Immediate","Joining date":"2010-01-20"},
...
...
...
]
Total number of lines: 8000rows which i saw the response body. Table is getting loaded properly.
Success scenario: in IE Compatible mode
Selected the date range from 2010 to 2011. (This range has 500 records only.) I can see that 500rows in the response body, the data is loading properly.
Failure scenario: in IE Compatible mode Selected the date range from 2010 to 2018. Ran the report. And getting an error message like 'Unable to load the data into the table' Analysis details in ResponseBody section.
Sometimes I saw 3500rows with invalid data, sometimes I saw 1500rows with incomplete data like
[
{"Demo ds abc totals":123.25,"Employee Age Limit":"0-17","Joining type":"Immediate","Joining date":"2010-01-19"},
{"Demo ds abc totals":245.25,"Employee Age Limit":"0-20","Joining type":"Immediate","Joining date":"2010-01-20"},
...
...
...
{"Demo ds abc totals":245.25,"Employee Age Limit":"0-20","Joining type":"Immediate",
How to resolve the above problem
Please help me. Thanks in advance.

Comments