distribute.js 1.4 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. $('#result').html('');
  19. $.ajax({
  20. type : 'get',
  21. dataType : 'json',
  22. contentType : 'application/json; charset=utf-8',
  23. url : '../jaxrs/distribute/assemble/source/' + source,
  24. xhrFields : {
  25. 'withCredentials' : true
  26. },
  27. crossDomain : true
  28. }).always(function(json) {
  29. $('#result').html(JSON.stringify(json, null, 4));
  30. });
  31. }
  32. function distribute_webServerAssemble(source) {
  33. $('#result').html('');
  34. $.ajax({
  35. type : 'get',
  36. dataType : 'json',
  37. contentType : 'application/json; charset=utf-8',
  38. url : '../jaxrs/distribute/webserver/assemble/source/' + source,
  39. xhrFields : {
  40. 'withCredentials' : true
  41. },
  42. crossDomain : true
  43. }).always(function(json) {
  44. $('#result').html(JSON.stringify(json, null, 4));
  45. });
  46. }