Debian Codegraph @

old-tests/tests_onhold/3_ajax/sServerMethod.js

raw
1 // DATA_TEMPLATE: empty_table
2 oTest.fnStart( "sServerMethod" );
3
4
5 $(document).ready( function () {
6 /* Check the default */
7 var oTable = $('#example').dataTable( {
8 "sAjaxSource": "../data_sources/method.php?method=get"
9 } );
10
11 oTest.fnWaitTest(
12 "Default method was GET",
13 null,
14 function () {
15 // A valid request will place a single row in the table
16 return $('tbody td').eq(0).html() === '1';
17 }
18 );
19
20 oTest.fnWaitTest(
21 "Can make a POST request",
22 function () {
23 oSession.fnRestore();
24 $('#example').dataTable( {
25 "sAjaxSource": "../data_sources/method.php?method=post",
26 "sServerMethod": "POST"
27 } );
28 },
29 function () {
30 return $('tbody td').eq(0).html() === '1';
31 }
32 );
33
34 oTest.fnWaitTest(
35 "Can make a PUT request",
36 function () {
37 oSession.fnRestore();
38 $('#example').dataTable( {
39 "sAjaxSource": "../data_sources/method.php?method=put",
40 "sServerMethod": "PUT"
41 } );
42 },
43 function () {
44 return $('tbody td').eq(0).html() === '1';
45 }
46 );
47
48 oTest.fnComplete();
49 } );