引入这两个js
<script src="{webroot}lib/validator/jquery.validator.js"></script>
<script src="{webroot}lib/tips/jquery.tips.js"></script>
提交页面插入下方JS
<script>
$(".formname").validator(
{
stopOnError:true,
theme:'yellow_right_effect',
ignore:':hidden',
beforeSubmit:function(){$("input[type='submit']").attr("disabled",true);},
valid:function(form)
{
$.fn.tips({type:'loading',content:'数据提交中'});
$.ajax(
{
url:"/plug/form.asp?act=db&id=1", //←这一块修改提交地址和id号
type:"post",
data:$(form).serialize(),
success:function(data){
data=jQuery.parseJSON(data);
var type="warn";
if(data.status=="y"){type="ok";}
$.fn.tips({type:type,content:data.info});
if(data.status=="y"){setTimeout('location.href=""',1000);}//←这一块刷新地址修改
else {$("input[type='submit']").attr("disabled",false);} } }); }, invalid:function(){$("input[type='submit']").attr("disabled",false);} } ); </script>