$result .= "<div id='" . $pin['pin'] . "'>" . $pin['pin'] . " [ <a href='#' onclick='javascript:delete_pin(" . $pin['pin'] . "); return false;'>X</a> ]</div>"; } } else { $result = "<center id='no-pins'><b>Нет добавленных пин-кодов</b></center>"; } } else { $result = "<b>Ошибка!</b>"; } echo $result; die; } else { if ($action == 'get_answers') { $question_id = isset($_POST['question_id']) ? (int) $_POST['question_id'] : null; if ($question_id && $question_model->is_provider_question($provider_id, $question_id)) { $result = ''; $answers = $question_model->get_answers($question_id); if (count($answers) > 0) { foreach ($answers as $answer) { $result .= "<div id='answer_" . $answer['answer_id'] . "' style='margin-bottom: 5px;'>" . "<input type='text' name='answers[]' value=" . $answer['answer'] . " class='text ui-widget-content ui-corner-all' style='margin: 0px; background: #ededed; width: 83%; display: inline;' disabled />" . "<nobr>[ <a href='#' onclick='javascript:delete_answer(" . $answer['answer_id'] . "); return false;' style='text-decoration: none; color: red; font-weight: bold;'>x</a> ]</nobr>" . "<br /></div>"; } } else { $result = 'Нет отгадок'; } } echo $result; die; } else { if ($action == 'delete_answer') { header("Content-Type: application/json"); $answer_id = isset($_POST['answer_id']) ? (int) $_POST['answer_id'] : null; if ($answer_id && $question_model->is_provider_answer($provider_id, $answer_id)) {