回答編集履歴

1

sample

2018/11/29 03:22

投稿

yambejp
yambejp

スコア114883

test CHANGED
@@ -21,3 +21,65 @@
21
21
 
22
22
 
23
23
  命題にラジオボタンについては該当する部分が見当たらないのでなんとも言えません
24
+
25
+
26
+
27
+ # sample
28
+
29
+ - html
30
+
31
+ ```HTML
32
+
33
+ <script>
34
+
35
+ $(function(){
36
+
37
+ $(document).ready( function(){
38
+
39
+ var c=0;
40
+
41
+ var timerId=setInterval(function(){c=c>=3?0:c+1;$('.loading').html("loading"+".".repeat(c))},500);
42
+
43
+ $.ajax({
44
+
45
+ url: "hoge.php",
46
+
47
+ method: "POST",
48
+
49
+ }).done(function(data) {
50
+
51
+ $("#result").html(data);
52
+
53
+ clearInterval(timerId);
54
+
55
+ $('.loading').html("");
56
+
57
+ }).fail(function(xhr, err){
58
+
59
+ console.log(textStatus);
60
+
61
+ });
62
+
63
+ });
64
+
65
+ });
66
+
67
+ </script>
68
+
69
+ <div id="result" ></div>
70
+
71
+ <div class="loading"></div>
72
+
73
+ ```
74
+
75
+ - hoge.php
76
+
77
+ ```PHP
78
+
79
+ <?php
80
+
81
+ sleep(5);
82
+
83
+ print "load complete";
84
+
85
+ ```