假设我提交了表单,它会给我一个错误或成功消息。我关闭了模式,如果我再次点击打开它,消息仍然存在。我该如何清除它?
$("#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
});
我通过调用模态
<a data-toggle="modal" href="#chg_settings">Settings</a>
这是消息 div
<div id="message_ajax"></div>