Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/366.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Jquery完全关闭引导模式对话框_Javascript_Jquery_Css_Twitter Bootstrap - Fatal编程技术网

Javascript Jquery完全关闭引导模式对话框

Javascript Jquery完全关闭引导模式对话框,javascript,jquery,css,twitter-bootstrap,Javascript,Jquery,Css,Twitter Bootstrap,下面是我使用jquery关闭引导模式的代码 //Start to hide bootstrap modal $('#continue-last-level').modal('hide'); //Line 1 //End //Codes to execute another function $.ajax({ //Line 2 url : '/qst/continue_last_level/',

下面是我使用jquery关闭引导模式的代码

//Start to hide bootstrap modal
    $('#continue-last-level').modal('hide'); //Line 1
//End

//Codes to execute another function 
        $.ajax({                             //Line 2
        url : '/qst/continue_last_level/',
        type : 'post',
        dataType: 'JSON',
        data : 'performance_level='+performance_level,
        success : function (data) 
        {
            localStorage.setItem("key", 60*3*data.total_questions);
            localStorage.setItem("question_id", data.first_question_id);
            localStorage.setItem("question_number", data.question_number);
            view_question_template(performance_level);
        }
        });
    }
//End code 
我的问题是在执行第1行的代码后,我想执行第2行的代码,引导模式已隐藏,但仍有一个div未隐藏。。。这是我的屏幕简图供你参考

图1

在我点击yes之后…假设调用函数来执行第2行的代码,模态被隐藏了,但是。。。
隐藏方法是异步的:

手动隐藏模态在模式实际隐藏之前返回调用方(即
隐藏.bs.modal
事件发生之前)

因此,您需要在代码中说明这一点,并使用Bootstrap提供的
hidden
事件:

$('#continue-last-level').one('hidden.bs.modal', function () {
    // modal is now hidden
    // your code here
}).modal('hide');
$('#continue-last-level').one('hidden.bs.modal', function () {
    // modal is now hidden
    // your code here
}).modal('hide');