ajax成功后的模态重新加载

时间:2016-10-12 15:55:04

标签: javascript ajax twitter-bootstrap

有人可以帮我这个代码吗? 我正在尝试重新加载模式以在另一个数据库查询中使用 我有成功,我想重新加载模式以用于其他记录

if(result === 'success'){
  $("#editarModalOcup").modal('hide');
  $('#success .modal-body').html('Informação: ' + data.message);
  $('#success').modal('show');
  $('#success').on('hidden.bs.modal', function () {
    /*$('#editarModalOcup').on('hidden.bs.modal', function() {
        $(this).removeData('bs.modal');
     });
     $("#editarModalOcup").modal('show');*/
  });
}

但是这段代码不起作用,按钮得到禁止的信号,我不能使用它...任何帮助?

由于

UPDATE Html模式

<div class="modal fade" id="editarModalOcup" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
    <div class="modal-content">
        <div class="modal-header modal-header-success">
            <button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
            <h3><i class="fa fa-pencil-square-o"></i> Editar Ocupação de Sala</h3>
        </div>
        <div class="modal-body">
            <!-- The form is placed inside the body of modal -->
            <form id="editarOcupacao" method="post">
                <div class="form-group">
                    <input type="hidden" name="edit_ocupacao" id="edit_ocupacao">
                </div>
                <div class="form-group">
                    <input type="hidden" name="edit_dia" id="edit_dia">
                </div>
                <div class="form-group">
                    <input type="hidden" name="edit_tempo" id="edit_tempo">
                </div>
                <div class="form-group">
                    <label for="recipient-name" class="control-label">Sala:</label>
                    <input class="form-control" name="edit_sala_nome" id="edit_sala_nome" disabled="true">
                </div>
                <div class="form-group">
                    <div class="input-group margin-bottom-sm">
                        <span class="input-group-addon"><i class="fa fa-list fa-fw"></i></span>
                        <select name="id_turma" class="form-control">
                            <?php echo $optionTurma ?>
                        </select>
                    </div>
                </div>
                <div class="form-group">
                    <input type="hidden" name="editarOcup" id="editarOcup" value="editarOcup">
                </div>
                <div class="modal-footer"
                <div class="form-group">
                    <button type="submit" class="btn btn-success">Atualizar</button>
                    <button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
                </div>
        </div>
        </form>
    </div>
</div>

1 个答案:

答案 0 :(得分:0)

对于那些有同样问题的人 使用formvalidation执行:

 $('#modal').show().formValidation('resetForm');