模态对话框不显示

时间:2019-07-23 11:01:21

标签: javascript php html modal-dialog

我正在更改一些PHP脚本,您不能从数据表中删除受保护的用户,现在由于某种原因,该模式显示了警告“您确定要删除...?”警告。不再显示,但背景变暗,您也无法与页面进行互动(即使所选用户未受到保护)

我分析了代码,但没有发现任何问题(我是业余爱好者,只知道学校的IT技术)

HTML代码

<div class="modal fade" tabindex="-1" role="dialog" id="modal_delete">
    <div class="modal-dialog" role="document">
        <div class="modal-content">
            <form method="post" ng-submit="submitForm()">
                <div class="modal-header">
                    <h4 class="modal-title">{{modalTitle}}</h4>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
                </div>
                <div class="modal-body">
                    <h5>Sind Sie sich sicher diesen Benutzer unwiderruflich zu löschen?</h5>
                    <p ng-class="customStyle.colorClass">{{successMessage}}</p>
                </div>
                <div class="modal-footer">
                    <input type="hidden" name="hidden_id" value="{{hidden_id}}" />
                    <input type="submit" name="submit" id="submit" class="btn btn-info" value="Ja, ich bin mir sicher!"/>
                    <button type="button" class="btn btn-default" data-dismiss="modal">Schließen</button>
                </div>
            </form>
        </div>
    </div>
</div>

AngularJS(JavaScript)代码

$scope.openModalDelete = function(){
        var modal_popup = $("#modal_delete");
        modal_popup.modal('show');
        $scope.deleteMessage();
    }

$scope.closeModalDelete = function(){
        var modal_popup = $('#modal_delete');
        modal_popup.modal('hide');
    }

$scope.submitForm = function(){
        $http({
            method: 'POST',
            url: '../ajax/benutzer_insertData.php',
            data: {
                'isAdmin': $scope.isAdmin,
                'password': $scope.password,
                'passwordValidate': $scope.passwordValidate,
                'id': $scope.currentId, 
                'first_name': $scope.first_name, 
                'last_name': $scope.last_name, 
                'email': $scope.email, 
                'action': $scope.submit_button}
        }).then(function successCallback(response){
            $scope.turnColor(response.data.color);
            $scope.stateSet = $scope.state;
            $scope.success = true;
            $scope.error = false;
            $scope.successMessage = response.data.successMsg;
            $scope.errFirstName = response.data.firstNameError;
            $scope.errLastName = response.data.lastNameError;
            $scope.errEMail = response.data.eMailError;
            $scope.errPassword = response.data.passwordError;
            $scope.form_data = {};
            $scope.getData();
        });
    }

$scope.deleteData = function(id){
        $scope.modalTitle = "Benutzer löschen";
        $scope.submit_button = "Löschen";
        $scope.currentId = id;
        $scope.openModalDelete();
    }

PHP代码

if($request->action == 'Löschen'){
            $sql = "DELETE FROM users WHERE id = ".$id." AND protected = 0";
            $statement = $con->prepare($sql);
            $statement->execute();
            $successMsg = "Benutzer wurde erfolgreich gelöscht";
            $color = "green";
        }

没有错误消息之类的东西,控制台完全正常

0 个答案:

没有答案