Добавить переключатель с помощью $ .each () - PullRequest
0 голосов
/ 21 ноября 2019

Попытка добавить радио-кнопки, но отображает [объект объекта]. В чем может быть проблема в моем коде?

.append('<li>'+JSON.parse(data.responseText).question+' ('+JSON.parse(data.responseText).score+'pts) <div class="row mb-2"> <div class="col-10"> <div class="form-group">'+$.each(JSON.parse(data.responseText).choices, function(key, value){
                        '{{Form::radio("radio", "value", ["class" => "form-control"])}}'
                })+' </div> </div> </div></li>');

Консоль

choices: Array(4)
0: {id: 121, quiz_question_id: 91, choice: "B", created_at: "2019-11-21 
05:35:42", updated_at: "2019-11-21 05:35:42"}
1: {id: 122, quiz_question_id: 91, choice: "G", created_at: "2019-11-21 
05:35:42", updated_at: "2019-11-21 05:35:42"}
2: {id: 123, quiz_question_id: 91, choice: "C", created_at: "2019-11-21 
05:35:42", updated_at: "2019-11-21 05:35:42"}
3: {id: 124, quiz_question_id: 91, choice: "C1", created_at: "2019-11-21 
05:35:42", updated_at: "2019-11-21 05:35:42"}
length: 4
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...