1
0
mirror of https://github.com/DataTables/DataTables.git synced 2024-12-04 16:24:11 +01:00
DataTables/media/unit_testing/tests_onhold/3_ajax/sServerMethod.js

50 lines
1.0 KiB
JavaScript
Raw Normal View History

// DATA_TEMPLATE: empty_table
oTest.fnStart( "sServerMethod" );
$(document).ready( function () {
/* Check the default */
var oTable = $('#example').dataTable( {
"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( {
"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( {
"sAjaxSource": "../data_sources/method.php?method=put",
"sServerMethod": "PUT"
} );
},
function () {
return $('tbody td').eq(0).html() === '1';
}
);
oTest.fnComplete();
} );