$(document).ready(function(){
这个就是页面加载的功能
})
window.location.href=location.href, 浏览器自带的重新加载机制 无需在加上 history.go(-1);了
/**
用户删除
*/
function deleteUser(userID){
if(window.confirm("你确定要删除用户吗?")){
$.ajax({
url:"<%=request.getContextPath()%>/user/deleteUser",
type:"post",
data: {
userID : userID
},
dataType : "json",
success:function(msgs){
if(msgs==1){
alert("删除成功!");
window.location.href = location.href;
}
},
error:function(){
alert("很遗憾,删除失败...");
}
});
}
}
点击事件
<p class="demo">你好</p>
<script type="text/javascript">
$(".demo").click(function(){
alert("你好")
})
</script>
表单的验证问题
$("#addIntegrationForm").submit(function(){
$(".validate_input_error").css("display", "none"); 启动之后把function就隐藏了 效果就是,验证只会出现一次
var
authenticat
= true;
定义了一个变量,在这里是表示验证开启;
var sourcename=$("#sourcename").val();
var points=$("#points").val();
var description=$("#description").val();
var lable1="<label class=\"validate_input_error\" style=\"color:red\">*积分名称不能为空</label>";
验证出错语句
var lable2="<label class=\"validate_input_error\" style=\"color:red\">*积分数值不能为空</label>";
var lable3="<label class=\"validate_input_error\" style=\"color:red\">*积分描述不能为空</label>";
if(sourcename==""||sourcename==null){
$("#sourcename").after(lable1);
authenticat = false;
}
if(points==""||points==null){
$("#points").after(lable2);
authenticat = false;
}
if(description==""||description==null){
$("#description").after(lable3);
authenticat = false;
}
return authenticat;
})