complex.js 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. complex_parameter = {};
  2. function complex_query_init() {
  3. var str = '<table border="1" width="100%">';
  4. str += '<tr><td>query:</td><td><input type="text" id="query" style="width:95%"/></td></tr>';
  5. str += '<tr><td colspan="2"><a href="#" id="company">查找公司的直接下属公司,直接下属部门.</a></td></tr>';
  6. str += '<tr><td colspan="2"><a href="#" id="department">查找部门的直接下属部门,直接下属身份.</a></td></tr>';
  7. str += '<tr><td colspan="2"><a href="#" id="person">查找个人的公司属性,部门属性,身份.</a></td></tr>';
  8. str += '</table>';
  9. $('#content').html(str);
  10. $('#company').click(function() {
  11. complex_query_company($('#query').val());
  12. });
  13. $('#department').click(function() {
  14. complex_query_department($('#query').val());
  15. });
  16. $('#person').click(function() {
  17. complex_query_person($('#query').val());
  18. });
  19. }
  20. function complex_query_company(id) {
  21. $('#result').html('');
  22. $.ajax({
  23. type : 'get',
  24. dataType : 'json',
  25. url : '../jaxrs/complex/company/' + id,
  26. xhrFields : {
  27. 'withCredentials' : true
  28. },
  29. crossDomain : true
  30. }).always(function(json) {
  31. $('#result').html(JSON.stringify(json, null, 4));
  32. });
  33. }
  34. function complex_query_department(id) {
  35. $('#result').html('');
  36. $.ajax({
  37. type : 'get',
  38. dataType : 'json',
  39. url : '../jaxrs/complex/department/' + id,
  40. xhrFields : {
  41. 'withCredentials' : true
  42. },
  43. crossDomain : true
  44. }).always(function(json) {
  45. $('#result').html(JSON.stringify(json, null, 4));
  46. });
  47. }
  48. function complex_query_person(id) {
  49. $('#result').html('');
  50. $.ajax({
  51. type : 'get',
  52. dataType : 'json',
  53. url : '../jaxrs/complex/person/' + id,
  54. xhrFields : {
  55. 'withCredentials' : true
  56. },
  57. crossDomain : true
  58. }).always(function(json) {
  59. $('#result').html(JSON.stringify(json, null, 4));
  60. });
  61. }