debug.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. debug_parameter = {};
  2. function debug_init() {
  3. $('#result').html('');
  4. $('#content').html('');
  5. var str = '<table border="1" width="100%">';
  6. str += '<tr><td colspan="2"><a href="#" id="get">get</a>&nbsp<a href="#" id="on">on</a>&nbsp;<a href="#" id="off">off</a></td></tr>';
  7. str += '<tr><td>debug:</td><td id="status">&nbsp;</td></tr>';
  8. str += '</table>';
  9. $('#content').html(str);
  10. $('#get').click(function() {
  11. debug_get();
  12. });
  13. $('#on').click(function() {
  14. debug_on();
  15. });
  16. $('#off').click(function() {
  17. debug_off();
  18. });
  19. }
  20. function debug_get() {
  21. $.ajax({
  22. type : 'get',
  23. dataType : 'json',
  24. url : '../jaxrs/debug',
  25. contentType : 'application/json; charset=utf-8',
  26. xhrFields : {
  27. 'withCredentials' : true
  28. },
  29. crossDomain : true
  30. }).done(function(json) {
  31. if (json.type == 'success') {
  32. $('#status').html(json.data.value + '');
  33. }
  34. }).always(function(json) {
  35. $('#result').html(JSON.stringify(json, null, 4));
  36. });
  37. }
  38. function debug_on() {
  39. $.ajax({
  40. type : 'get',
  41. dataType : 'json',
  42. url : '../jaxrs/debug/true',
  43. contentType : 'application/json; charset=utf-8',
  44. xhrFields : {
  45. 'withCredentials' : true
  46. },
  47. crossDomain : true
  48. }).done(function(json) {
  49. if (json.type == 'success') {
  50. $('#status').html(json.data.value + '');
  51. }
  52. }).always(function(json) {
  53. $('#result').html(JSON.stringify(json, null, 4));
  54. });
  55. }
  56. function debug_off() {
  57. $.ajax({
  58. type : 'get',
  59. dataType : 'json',
  60. url : '../jaxrs/debug/false',
  61. contentType : 'application/json; charset=utf-8',
  62. xhrFields : {
  63. 'withCredentials' : true
  64. },
  65. crossDomain : true
  66. }).done(function(json) {
  67. if (json.type == 'success') {
  68. $('#status').html(json.data.value + '');
  69. }
  70. }).always(function(json) {
  71. $('#result').html(JSON.stringify(json, null, 4));
  72. });
  73. }