distribute.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. distribute_parameter = {};
  2. function distribute_init() {
  3. $('#content').html('');
  4. $('#result').html('');
  5. var str = '<table border="1" width="100%">';
  6. str += '<tr><td colspan="2"><a href="#" id="assemble">assemble</a>&nbsp;<a href="#" id="webServerAssemble">webServerAssemble</a></td></tr>';
  7. str += '<tr><td>source</td><td><input type="text" style="width:95%" id="source"></td></tr>';
  8. str += '</table>';
  9. $('#content').html(str);
  10. $('#assemble').click(function() {
  11. distribute_assemble($('#source').val());
  12. });
  13. $('#webServerAssemble').click(function() {
  14. distribute_webServerAssemble($('#source').val());
  15. });
  16. }
  17. function distribute_assemble(source) {
  18. $('#content').html('');
  19. $('#result').html('');
  20. $.ajax({
  21. type : 'get',
  22. dataType : 'json',
  23. contentType : 'application/json; charset=utf-8',
  24. url : '../jaxrs/distribute/assemble/source/' + source,
  25. xhrFields : {
  26. 'withCredentials' : true
  27. },
  28. crossDomain : true
  29. }).always(function(json) {
  30. $('#result').html(JSON.stringify(json, null, 4));
  31. });
  32. }
  33. function distribute_webServerAssemble(source) {
  34. $('#content').html('');
  35. $('#result').html('');
  36. $.ajax({
  37. type : 'get',
  38. dataType : 'json',
  39. contentType : 'application/json; charset=utf-8',
  40. url : '../jaxrs/distribute/webserver/assemble/source/' + source,
  41. xhrFields : {
  42. 'withCredentials' : true
  43. },
  44. crossDomain : true
  45. }).always(function(json) {
  46. $('#result').html(JSON.stringify(json, null, 4));
  47. });
  48. }