質問するログイン新規登録

質問編集履歴

1

base.html追加.game.htmlの内容を修正.

2020/11/04 06:04

投稿

kureid
kureid

スコア3

title CHANGED
File without changes
body CHANGED
@@ -18,7 +18,26 @@
18
18
 
19
19
 
20
20
  ### 該当のソースコード
21
+ base.html
22
+ ```
23
+ {% load static %}
24
+ <!DOCTYPE html>
25
+ <html lang="ja">
26
+ <head>
27
+ <meta charset="UTF-8" />
28
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
29
+ <script type="text/javascript" src="http://code.jquery.com/jquery-3.3.1.min.js" ></script>
30
+ <link rel="icon" href="{% static 'img/favicon.ico' %}" />
31
+ <title>{% block title %} {% endblock title %}</title>
32
+ </head>
33
+ <body>
34
+ {% block contents %} {% endblock contents%}
35
+ </body>
36
+ </html>
21
37
 
38
+ ```
39
+
40
+ game.html
22
41
  ```html
23
42
  {% extends 'coloring/base.html' %} {% block title %} game {% endblock title %}
24
43
  {% block contents %}
@@ -47,9 +66,14 @@
47
66
  },
48
67
  timeout: 5000
49
68
  })
50
- .done( function() {
69
+ .done( function(data) {
70
+ alert(data);
51
- $('#network_image').html();
71
+ console.log(data);
52
72
  })
73
+ .fail( function(xhr, err) {
74
+ alert(err);
75
+ console.log(err);
76
+ })
53
77
  });
54
78
  });
55
79
  </script>
@@ -58,7 +82,7 @@
58
82
 
59
83
  ```
60
84
 
61
-
85
+ views.py
62
86
  ```python
63
87
  def ajax_change_color(request, node_num):
64
88
  color = request.POST.get('color')