Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/86.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
Jquery 当modal使用Twitter boostrap关闭时,如何清除div?_Jquery_Twitter Bootstrap - Fatal编程技术网

Jquery 当modal使用Twitter boostrap关闭时,如何清除div?

Jquery 当modal使用Twitter boostrap关闭时,如何清除div?,jquery,twitter-bootstrap,Jquery,Twitter Bootstrap,假设我提交表单,它要么给我一个错误消息,要么给我一个成功消息。我关闭模式,如果我再次单击打开它,消息仍然存在。我该怎么清理它 $("#JqAjaxForm").submit(function(e){ e.preventDefault(); dataString = $("#JqAjaxForm").serialize(); $.ajax({ type: "POST",

假设我提交表单,它要么给我一个错误消息,要么给我一个成功消息。我关闭模式,如果我再次单击打开它,消息仍然存在。我该怎么清理它

$("#JqAjaxForm").submit(function(e){                
        e.preventDefault();

        dataString = $("#JqAjaxForm").serialize();

        $.ajax({
            type: "POST",
            url: "update.php",
            data: dataString,
            dataType: "json",
            success: function(data) {
            //clearForm("#JqAjaxForm");

                if(data.email_check == "invalid"){ 
                    $("#message_ajax").html("<p class='alert alert-error'>Sorry " + data.name + ", " + data.email + " is NOT a valid e-mail address. Try again.</p>");
                } else {                        
                    $("#message_ajax").html("<p class='alert alert-success'>" + data.newpasswd + " is a valid e-mail address. Thank you, " + data.name + ".</p>"); 
                }     
            }                
        });                 
});


$('#chg_settings').modal({
  backdrop: 'static',
  keyboard: true,
  show: false
});
$(“#JqAjaxForm”).submit(函数(e){
e、 预防默认值();
dataString=$(“#JqAjaxForm”).serialize();
$.ajax({
类型:“POST”,
url:“update.php”,
数据:dataString,
数据类型:“json”,
成功:功能(数据){
//clearForm(“JqAjaxForm”);
如果(data.email_check==“无效”){
$(“#message_ajax”).html(“

对不起”+data.name+,“+data.email+”不是有效的电子邮件地址。请重试。

”; }否则{ $(“#message_ajax”).html(“

”+data.newpasswd+”是有效的电子邮件地址。谢谢,“+data.name+”

”; } } }); }); $('chg#u设置')。模式({ 背景:“静态”, 键盘:没错, 节目:假 });
我称之为模态via

<a data-toggle="modal" href="#chg_settings">Settings</a>

这是留言组

<div id="message_ajax"></div>

您可以注册这样的事件

$('#chg_settings').on('hidden', function () {
  $("#message_ajax").html('');
})
当模式对用户完成隐藏时(将等待css转换完成),将触发此事件


打开对话框的单击处理程序在哪里?