test.html 716 B

123456789101112131415161718192021222324252627
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <title>Hello CORS</title>
  5. <script src="http://code.jquery.com/jquery-3.5.1.min.js"
  6. integrity="sha256-9/aliU8dGd2tb6OSsuzixeV4y/faTqgFtohetphbbj0="
  7. crossorigin="anonymous"></script>
  8. </head>
  9. <body>
  10. <div>
  11. <p class="greeting-id">The ID is </p>
  12. <p class="greeting-content">The content is </p>
  13. </div>
  14. <script>
  15. $(document).ready(function() {
  16. $.ajax({
  17. url: "http://localhost:8080/greeting"
  18. }).then(function(data, status, jqxhr) {
  19. $('.greeting-id').append(data.id);
  20. $('.greeting-content').append(data.content);
  21. console.log(jqxhr);
  22. });
  23. });
  24. </script>
  25. </body>
  26. </html>