質問編集履歴

2

表記の変更

2020/08/18 23:56

投稿

zoetti
zoetti

スコア4

test CHANGED
File without changes
test CHANGED
@@ -2,17 +2,17 @@
2
2
 
3
3
  ご教授お願いいたします。
4
4
 
5
- クイズのWebアプリケーションを作成していて、Buttonを動的に作成しvalueに選択肢を記述しようとしています。
5
+ クイズのWebアプリケーションを作成していて、Buttonを動的に作成しvalue属性に選択肢を記述しようとしています。
6
6
 
7
7
  データはopen triviaというフリーのデータベースサーバからJson形式で取得しています。
8
8
 
9
- valueに選択肢をセットする際、取得してきたデータから選択肢部分を抽出してvalueに設定しようと思っています。
9
+ value属性に選択肢をセットする際、取得してきたデータから選択肢部分を抽出してvalue属性に設定しようと思っています。
10
10
 
11
11
  ### 発生している問題・エラーメッセージ
12
12
 
13
13
 
14
14
 
15
- valueに選択肢をセットする際、取得してきたデータから選択肢部分を抽出してvalueに設定しようと試みましたが、
15
+ value属性に選択肢をセットする際、取得してきたデータから選択肢部分を抽出してvalue属性に設定しようと試みましたが、
16
16
 
17
17
  設定されたデータが実態参照をしてしまうため、正しく文字列が出力されません。
18
18
 

1

Jsonデータの追記

2020/08/18 23:56

投稿

zoetti
zoetti

スコア4

test CHANGED
File without changes
test CHANGED
@@ -293,3 +293,53 @@
293
293
 
294
294
 
295
295
  ```
296
+
297
+ ```Json
298
+
299
+ {response_code: 0, results: Array(10)}
300
+
301
+ response_code: 0
302
+
303
+ results: Array(10)
304
+
305
+ 0:
306
+
307
+ category: "Entertainment: Film"
308
+
309
+ correct_answer: "The Thing"
310
+
311
+ difficulty: "easy"
312
+
313
+ incorrect_answers: (3) ["Carrie", "Misery", "The Green Mile"]
314
+
315
+ question: "Which of the following movies was not based on a novel by Stephen King? "
316
+
317
+ type: "multiple"
318
+
319
+ __proto__: Object
320
+
321
+ 1: {category: "Science & Nature", type: "multiple", difficulty: "medium", question: "Along with Oxygen, which element is primarily responsible for the sky appearing blue?", correct_answer: "Nitrogen", …}
322
+
323
+ 2: {category: "Entertainment: Film", type: "boolean", difficulty: "medium", question: "There aren't any live-action clones in "…ar Wars: Episode III - Revenge of the Sith".", correct_answer: "True", …}
324
+
325
+ 3: {category: "Entertainment: Video Games", type: "boolean", difficulty: "hard", question: "In "Portal 2", Cave Johnson started out Aperture Science as a shower curtain company.", correct_answer: "True", …}
326
+
327
+ 4: {category: "Geography", type: "multiple", difficulty: "medium", question: "Which of these countries is the smallest by population?", correct_answer: "Norway", …}
328
+
329
+ 5: {category: "Celebrities", type: "multiple", difficulty: "medium", question: "In what year did "Bob Ross" die?", correct_answer: "1995", …}
330
+
331
+ 6: {category: "General Knowledge", type: "multiple", difficulty: "medium", question: "Earl Grey tea is black tea flavoured with what?", correct_answer: "Bergamot oil", …}
332
+
333
+ 7: {category: "Celebrities", type: "multiple", difficulty: "medium", question: "Which American celebrity died in 1977 playing golf in La Moraleja, Madrid?", correct_answer: "Bing Crosby", …}
334
+
335
+ 8: {category: "Entertainment: Television", type: "multiple", difficulty: "easy", question: "On the NBC show Community, whose catch-phrase was "Pop! Pop!"?", correct_answer: "Magnitude", …}
336
+
337
+ 9: {category: "Science & Nature", type: "multiple", difficulty: "hard", question: "Autosomal-dominant Compelling Helio-Ophthalmic Out…drome is the need to do what when seeing the Sun?", correct_answer: "Sneeze", …}
338
+
339
+ length: 10
340
+
341
+ __proto__: Array(0)
342
+
343
+ __proto__: Object
344
+
345
+ ```