kyle před 2 roky
rodič
revize
3c6abb74c5
1 změnil soubory, kde provedl 33 přidání a 2 odebrání
  1. 33
    2
      public/testapi/testapi.html

+ 33
- 2
public/testapi/testapi.html Zobrazit soubor

15
 <div class="container">
15
 <div class="container">
16
     <h2>Test</h2>
16
     <h2>Test</h2>
17
     <form>
17
     <form>
18
-        <button>Send</button>
18
+        <button class="info">Send Info</button>
19
+        <button class="game">Send Game</button>
19
     </form>
20
     </form>
20
     <hr>
21
     <hr>
21
     <div class="output"></div>
22
     <div class="output"></div>
26
 
27
 
27
 <script>
28
 <script>
28
     $(document).ready(function () {
29
     $(document).ready(function () {
29
-        $("button").click(function (e) {
30
+        $(".info").click(function (e) {
30
             e.preventDefault();
31
             e.preventDefault();
31
 
32
 
32
             $.blockUI({
33
             $.blockUI({
52
                 $.unblockUI();
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
 </script>
87
 </script>
57
 </body>
88
 </body>