work.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. function work_getComplex_init() {
  2. $('#content').html('');
  3. $('#result').html('');
  4. var str = '<table border="1" width="100%">';
  5. str += '<tr><td colspan="2"><a href="#" id="get">get</a></td></tr>';
  6. str += '<tr><td>id:</td><td><input type="text" style="width:95%" id= "id"/></td></tr>';
  7. str += '</table>';
  8. $('#content').html(str);
  9. $('#get').click(function() {
  10. work_getComplex($('#id').val());
  11. });
  12. }
  13. function work_getComplex(id) {
  14. $('#result').html('');
  15. $.ajax({
  16. type : 'get',
  17. dataType : 'json',
  18. contentType : 'application/json; charset=utf-8',
  19. url : '../jaxrs/work/' + id + '/complex',
  20. xhrFields : {
  21. 'withCredentials' : true
  22. },
  23. crossDomain : true
  24. }).done(function(json) {
  25. $('#result').html(JSON.stringify(json, null, 4));
  26. });
  27. }
  28. function work_retract_init() {
  29. $('#content').html('');
  30. $('#result').html('');
  31. var str = '<table border="1" width="100%">';
  32. str += '<tr><td colspan="2"><a href="#" id="put">put</a></td></tr>';
  33. str += '<tr><td>id:</td><td><input type="text" style="width:95%" id= "id"/></td></tr>';
  34. str += '</table>';
  35. $('#content').html(str);
  36. $('#put').click(function() {
  37. work_retract($('#id').val());
  38. });
  39. }
  40. function work_retract(id) {
  41. $('#result').html('');
  42. $.ajax({
  43. type : 'put',
  44. dataType : 'json',
  45. contentType : 'application/json; charset=utf-8',
  46. url : '../jaxrs/work/' + id + '/retract',
  47. xhrFields : {
  48. 'withCredentials' : true
  49. },
  50. crossDomain : true
  51. }).done(function(json) {
  52. $('#result').html(JSON.stringify(json, null, 4));
  53. });
  54. }