From 9c51aa0ad78ede72f87f9b9e7361acf3c9e04793 Mon Sep 17 00:00:00 2001 From: Allan Jardine Date: Wed, 8 Aug 2012 16:27:42 +0100 Subject: [PATCH] New: xhr event --- examples/examples_support/syntax/js/shCore.js | 6 ++---- media/js/jquery.dataTables.js | 2 +- media/src/model/model.defaults.js | 2 +- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/examples/examples_support/syntax/js/shCore.js b/examples/examples_support/syntax/js/shCore.js index 61dccedb..a719d2ff 100644 --- a/examples/examples_support/syntax/js/shCore.js +++ b/examples/examples_support/syntax/js/shCore.js @@ -2694,12 +2694,10 @@ var dtLinks = [ /* Show and syntax highlight XHR returns from the server */ $(document).ready( function () { if ( $.fn.dataTableSettings.length >= 1 ) { - $('#example').dataTable().bind('xhr', function ( e, oSettings ) { + $('#example').dataTable().bind('xhr', function ( e, oSettings, json ) { var n = document.getElementById('latest_xhr'); if ( n ) { - n.innerHTML = JSON.stringify( - JSON.parse(oSettings.jqXHR.responseText), null, 2 - ); + n.innerHTML = JSON.stringify( json, null, 2 ); n.className = "brush: js;" SyntaxHighlighter.highlight({}, n); } diff --git a/media/js/jquery.dataTables.js b/media/js/jquery.dataTables.js index a4cd0e40..cb6e689b 100644 --- a/media/js/jquery.dataTables.js +++ b/media/js/jquery.dataTables.js @@ -8689,7 +8689,7 @@ oSettings.oApi._fnLog( oSettings, 0, json.sError ); } - $(oSettings.oInstance).trigger('xhr', oSettings); + $(oSettings.oInstance).trigger('xhr', [oSettings, json]); fnCallback( json ); }, "dataType": "json", diff --git a/media/src/model/model.defaults.js b/media/src/model/model.defaults.js index 4fa49a0f..0fa99b92 100644 --- a/media/src/model/model.defaults.js +++ b/media/src/model/model.defaults.js @@ -922,7 +922,7 @@ DataTable.defaults = { oSettings.oApi._fnLog( oSettings, 0, json.sError ); } - $(oSettings.oInstance).trigger('xhr', oSettings); + $(oSettings.oInstance).trigger('xhr', [oSettings, json]); fnCallback( json ); }, "dataType": "json",