kyle 2 years ago
parent
commit
3c6abb74c5
1 changed files with 33 additions and 2 deletions
  1. 33
    2
      public/testapi/testapi.html

+ 33
- 2
public/testapi/testapi.html View File

@@ -15,7 +15,8 @@
15 15
 <div class="container">
16 16
     <h2>Test</h2>
17 17
     <form>
18
-        <button>Send</button>
18
+        <button class="info">Send Info</button>
19
+        <button class="game">Send Game</button>
19 20
     </form>
20 21
     <hr>
21 22
     <div class="output"></div>
@@ -26,7 +27,7 @@
26 27
 
27 28
 <script>
28 29
     $(document).ready(function () {
29
-        $("button").click(function (e) {
30
+        $(".info").click(function (e) {
30 31
             e.preventDefault();
31 32
 
32 33
             $.blockUI({
@@ -52,6 +53,36 @@
52 53
                 $.unblockUI();
53 54
             });
54 55
         });
56
+
57
+        $(".game").click(function (e) {
58
+            e.preventDefault();
59
+
60
+            $.blockUI({
61
+                message: $('.spinner-border'),
62
+                css: {
63
+                    backgroundColor: 'transparent',
64
+                    border: '0'
65
+                },
66
+            });
67
+
68
+            $.ajax({
69
+                type: "post",
70
+                url: 'https://declare.taiwanpay.com.tw/api2021/game/Ud23d992163d295a1a08865fc10969598',
71
+                data: {
72
+                    "name": "Jojo"
73
+                },
74
+                dataType: "json",
75
+                contentType: "application/json;charset=utf-8"
76
+            }).done(function (result) {
77
+                console.log(result)
78
+
79
+            }).fail(function (jqXHR, textStatus) {
80
+                console.log(jqXHR);
81
+                console.log(textStatus);
82
+            }).always(function () {
83
+                $.unblockUI();
84
+            });
85
+        });
55 86
     });
56 87
 </script>
57 88
 </body>