单选按钮不刷新

时间:2017-12-29 01:25:37

标签: javascript php jquery ajax radio-button

我有以下html单选按钮和jquery脚本。当我第一次单击单选按钮时,它会正确更改值,但会禁用单选按钮。如何点击第一个单选按钮后,该功能会重置,以便我可以点击另一个单选按钮?

<form action="<?php echo $this->form_action; ?>" method="get">
<table cellspacing="0" cellpadding="0" margin-left="5px" class="display">
    <tr class="surround" id="<?php echo $project['project.id']; ?>">
        <td align="left" style="padding-left:22px" class="color-status-<?php echo $project['project.holiday']; ?>">
            <?php if (in_array($project['project.holiday'], array(0, 1, 2, 3, 4, 9))) { ?>
                <input name="holidayStatus" style="font-size: 15px; border:none; color:red;"
                       value="Holiday #:<?php echo $project['project.holiday']; ?>" maxlength="2">
                <br>
                <input type="radio" name="holidayStatus" value="0" <?php if ($project['project.holiday'] == 0)
                    echo 'checked'; ?>>None (0)
                <input type="radio" name="holidayStatus" value="1" <?php if ($project['project.holiday'] == 1)
                    echo 'checked'; ?>>Easter(1)
                <input type="radio" name="holidayStatus" value="2" <?php if ($project['project.holiday'] == 2)
                    echo 'checked'; ?>>Giving Day (2)<br>
            <?php } else { ?>
                <?php echo $project['status']; ?>
            <?php } ?>
        </td>
    </tr>
</table>
</form>



<script type="text/javascript">
    head.ready('jquery', function () {
        $(document).ready(function () {

////////////////////////////////////////
//          change editors pick status
////////////////////////////////////////

            $('input[name="holidayStatus"]').click(function () {
                var currstatus = this.value;
                var id = $(this).parents('tr').attr('id');

                $.ajax({
                    type: 'post',
                    url: "?module=projects&controller=index&action=changeHolidayStatus",
                    data: 'id=' + id + '&holidayStatus=' + currstatus,
                    beforeSend: function () {
                        $('.surround').animate({
                            'backgroundColor': '#ffdead'
                        }, 400);
                    },
                    success: function (result) {
                        if (result == 'ok') {
                            $.get(window.location.href, function (data) {
                                $('.surround').html($(data).find('.surround').html());
                                setTimeout(function () {
                                    $('.surround').animate({'backgroundColor': 'transparent'}, 400).find('.tooltip').simpletooltip();
                                    deletePage();
                                }, 500);
                            });
                        } else {
                            alert(result);
                            $('.surround').animate({'backgroundColor': 'transparent'}, 400);
                        }
                    }
                });
            });

        });
    });
</script>

0 个答案:

没有答案