我有一个获取用户详细信息的表单。 提交表单后,页面将被加载。我想在页面加载后显示一条成功消息。
<form name="myForm" class="contactus-template" method="post" onsubmit="return Formvalidation()">
</form>
function Formvalidation(){
var validate = validateForm();
if( validate == true ){
alert("success");
}
else{
alert("not success");
}
return validate;
}
这是我现在使用的脚本。这会在页面重新加载之前发出警报。我想在返回函数之后执行此操作。
最佳答案
使用引导通知:http://bootstrap-notify.remabledesigns.com/
还有这个脚本:
Alert = {
show: function(type, title, message, url, delay) {
$.notify({
title: title,
message: message,
url: url,
target: "_blank"
},{
type: type,
showProgressbar: false,
placement: {
from: "bottom",
align: "center"
},
delay: delay
});
},
}
如果页面重新加载,您可以使用 PHP 调用消息:
echo '<script>Alert.show("success", "", "Form submit success!", "", 3000);</script>';
关于javascript - 表单提交后的成功消息,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51095254/