質問編集履歴

1

情報の追加

2017/09/26 09:22

投稿

退会済みユーザー
test CHANGED
File without changes
test CHANGED
@@ -1,6 +1,122 @@
1
1
  非同期通信でformタグの中にactionを指定すべきでしょうか?
2
2
 
3
3
  ```ここに言語を入力
4
+
5
+ <select id="mainDD" data-placeholder="Choose" class="chzn-select" style="width:600px;">
6
+
7
+ {% for i in json_data.items.values %}
8
+
9
+ <option>{{ i }}</option>
10
+
11
+ {% endfor %}
12
+
13
+ </select>
14
+
15
+
16
+
17
+
18
+
19
+ {% for key, values in preprocessed %}
20
+
21
+ <select name="type" id=key>
22
+
23
+ {% for counter, value in values %}
24
+
25
+ <option value="{{ counter }}">{{ value }}</option>
26
+
27
+ {% endfor %}
28
+
29
+ </select>
30
+
31
+ {% endfor %}
32
+
33
+
34
+
35
+ <script type="text/javascript">
36
+
37
+
38
+
39
+ $(document).ready(function () {
40
+
41
+
42
+
43
+ $('#mainDD').on('change', function() {
44
+
45
+   console.log(11111111);
46
+
47
+ console.log($(this).val());
48
+
49
+ console.log(22222222);
50
+
51
+ console.log($('#mainDD :selected').text()) ;
52
+
53
+
54
+
55
+ var thisType = "type" + $(this).val();
56
+
57
+ console.log(33333333);
58
+
59
+ console.log(thisType);
60
+
61
+
62
+
63
+ for(i=1; i<5; i++) {
64
+
65
+ var thisId = "type" + i;
66
+
67
+ console.log(444444444);
68
+
69
+ console.log(thisId);
70
+
71
+ console.log(555555555);
72
+
73
+ console.log(thisType);
74
+
75
+ if(thisType !== thisId) {
76
+
77
+ $("#"+thisId).hide();
78
+
79
+ }
80
+
81
+ else {
82
+
83
+ $("#"+thisId).show();
84
+
85
+ }
86
+
87
+ }
88
+
89
+
90
+
91
+ }).trigger('change');
92
+
93
+
94
+
95
+ });
96
+
97
+
98
+
99
+ $('[name=type]').change(function() {
100
+
101
+ var array = [];
102
+
103
+ $('[name=alphabet] option:selected').each(function() {
104
+
105
+ array.push($(this).text());
106
+
107
+ });
108
+
109
+ console.log(array);
110
+
111
+ });
112
+
113
+
114
+
115
+
116
+
117
+ </script>
118
+
119
+
4
120
 
5
121
  <form id="postform" action="http://localhost:8000/app/" method="POST">
6
122