mirror of
https://github.com/DataTables/DataTables.git
synced 2024-11-29 11:24:10 +01:00
Don't initialise the xhr listener if there is no DataTable on the page
This commit is contained in:
parent
f46a49f7f4
commit
af16d8016c
18
examples/examples_support/syntax/js/shCore.js
vendored
18
examples/examples_support/syntax/js/shCore.js
vendored
@ -333,12 +333,14 @@ var dtLinks = [
|
||||
|
||||
/* Show and syntax highlight XHR returns from the server */
|
||||
$(document).ready( function () {
|
||||
$('#example').dataTable().bind('xhr', function ( e, oSettings ) {
|
||||
var n = document.getElementById('latest_xhr');
|
||||
n.innerHTML = JSON.stringify(
|
||||
JSON.parse(oSettings.jqXHR.responseText), null, 2
|
||||
);
|
||||
n.className = "brush: js;"
|
||||
SyntaxHighlighter.highlight({}, n);
|
||||
} );
|
||||
if ( $.fn.dataTableSettings.length > 1 ) {
|
||||
$('#example').dataTable().bind('xhr', function ( e, oSettings ) {
|
||||
var n = document.getElementById('latest_xhr');
|
||||
n.innerHTML = JSON.stringify(
|
||||
JSON.parse(oSettings.jqXHR.responseText), null, 2
|
||||
);
|
||||
n.className = "brush: js;"
|
||||
SyntaxHighlighter.highlight({}, n);
|
||||
} );
|
||||
}
|
||||
} );
|
Loading…
Reference in New Issue
Block a user