1
0
mirror of https://github.com/DataTables/DataTables.git synced 2024-12-10 22:24:10 +01:00
DataTables/media/unit_testing/tests_onhold/4_server-side/sServerMethod.js

53 lines
1.1 KiB
JavaScript
Raw Normal View History

// DATA_TEMPLATE: empty_table
oTest.fnStart( "sServerMethod" );
$(document).ready( function () {
/* Check the default */
var oTable = $('#example').dataTable( {
"bServerSide": true,
"sAjaxSource": "../data_sources/method.php?method=get"
} );
oTest.fnWaitTest(
"Default method was GET",
null,
function () {
// A valid request will place a single row in the table
return $('tbody td').eq(0).html() === '1';
}
);
oTest.fnWaitTest(
"Can make a POST request",
function () {
oSession.fnRestore();
$('#example').dataTable( {
"bServerSide": true,
"sAjaxSource": "../data_sources/method.php?method=post",
"sServerMethod": "POST"
} );
},
function () {
return $('tbody td').eq(0).html() === '1';
}
);
oTest.fnWaitTest(
"Can make a PUT request",
function () {
oSession.fnRestore();
$('#example').dataTable( {
"bServerSide": true,
"sAjaxSource": "../data_sources/method.php?method=put",
"sServerMethod": "PUT"
} );
},
function () {
return $('tbody td').eq(0).html() === '1';
}
);
oTest.fnComplete();
} );