common_rest.html 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="UTF-8" />
  5. <script lang="text/javascript">
  6. //GET
  7. function m_get( url ) {
  8. send_get_request( url );
  9. }
  10. //POST
  11. function m_post() {
  12. send_post_request( url );
  13. }
  14. //PUT
  15. function m_post() {
  16. send_put_request( url );
  17. }
  18. //DELETE
  19. function m_delete() {
  20. send_delete_request_as_url( url );
  21. }
  22. /////////////////////////////////////////////////////////////////////////////////////////////////
  23. $(document).ready(function() {
  24. $('#get').click(function() {
  25. send_get_request( $("#url").val() );
  26. });
  27. $('#post').click(function() {
  28. send_post_request( $("#url").val() );
  29. });
  30. $('#put').click(function() {
  31. send_put_request( $("#url").val() );
  32. });
  33. $('#delete').click(function() {
  34. send_delete_request( $("#url").val() );
  35. });
  36. });
  37. </script>
  38. </head>
  39. <body>
  40. <div style="float: left; width: 720px;">
  41. <div style="width: 100%;">
  42. <table border="1" style="width:100%">
  43. <tr>
  44. <td>URL:</td>
  45. <td><input type="text" id="url" style="width:95%" placeholder="../jaxrs/forum/"/></td>
  46. </tr>
  47. <tr>
  48. <td>type:</td>
  49. <td>
  50. 通用REST服务调用
  51. </td>
  52. </tr>
  53. <tr>
  54. <td colspan="2">
  55. <button id="get">GET</button>
  56. <button id="post">POST</button>
  57. <button id="put">PUT</button>
  58. <button id="delete">DELETE</button>
  59. </td>
  60. </tr>
  61. <tr>
  62. <td colspan="2">
  63. <textarea id="content" style="width:97%;height:300px">{}</textarea>
  64. </td>
  65. </tr>
  66. <tr>
  67. <td colspan="2">
  68. <textarea id="result" style="width:97%;height:400px"></textarea>
  69. </td>
  70. </tr>
  71. </table>
  72. </div>
  73. </div>
  74. </body>
  75. </html>