我有一个表单来获得用户的详细信息。一旦表单提交,页面就会加载。我想在页面加载后显示一条成功的消息。
<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;
}这是我现在使用的脚本。这会在页面重新加载之前发出警报。我想在返回函数之后做这件事。
发布于 2018-06-29 14:22:48
使用引导通知: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>';发布于 2018-07-21 02:26:28
是否考虑过将用户重定向到另一个页面成功/失败,并在该页面中显示结果?
发布于 2018-06-29 14:14:34
如果您想在用户单击submit按钮时调用Formvalidation(),则onsubmit="return Formvalidation()"应该简单地为onsubmit="Formvalidation()"。
https://stackoverflow.com/questions/51095254
复制相似问题