$(function() { if($("#bookstaus").length>0) { $.ajax( { type:"post", cache:false, url:"?act=islogin", success:function(_){$("#bookstaus").html(_);} }); }; $(".form_book").validator( { stopOnError:true, theme:'yellow_top', ignore:':hidden', valid:function(form) { $.fn.tips({type:'loading',content:'数据提交中'}); $.ajax( { url:"?act=add", type:"post", data:$(form).serialize(), success:function(data){ data=jQuery.parseJSON(data); if(data.status!="y"){$.fn.tips({content:data.info});} if(data.status=="y") { var info=data.info.substring(1); $.fn.tips({type:"ok",content:info}); $(".form_book")[0].reset(); if(data.info.substring(0,1)==2){setTimeout(function(){location.href='?';},1500)} } } }); } }); })