Access HTTP response status code in fnServerData.error

Access HTTP response status code in fnServerData.error

vinodjayendravinodjayendra Posts: 5Questions: 0Answers: 0
edited March 2013 in Plug-ins
All,

1) I am trying to access HTTP response status code returned as part of JSON in fnServerData.error function i am overriding
2) Based on the status code trying show a info message on the datatable instead of a window alert

Any pointers on how to do the same .. ?


fnServerData: function(sUrl, aoData, fnCallback, oSettings) {
// Perform the AJAX call using the data table settings.
oSettings.jqXHR = $.ajax({
type: 'POST',
url: sUrl,
dataType: 'json',
data: aoData,
cache: false,
success: fnCallback,
error: function(jqXHR, textStatus, errorThrown) {

//1. hide the processing display
oSettings.oApi._fnProcessingDisplay(oSettings,false)

//2. Read response status code


//3. Trying to set the info empty message on table (not working)
//$this.$element.oLanguage.sInfoEmpty = "Empty"
//$this.$element..oLanguage.sEmptyTable = "Empty"


},
success: function(data, textStatus, jqXHR) {
// Trigger an event that the data table got reloaded
$this.$element.trigger('reload', data);
// Invoke the specified callback to handle the new data
fnCallback(data, textStatus, jqXHR);
return true;
},
complete: function() {
$this._inFlight = false;


if ($this._pending) {
$this.reload();
}
}


});
}
}
This discussion has been closed.