菜鸟中的菜

导航

在MVC中怎么调用Action方法

今天 我开始做我们的作业时候  不知道怎么调用Action方法  在网上找了些资料才知道怎么做

View Code
$.ajax({
type: "POST",
url: "Stu/DeleteStuInfo",
data: "StuNo=" + id,
datatype: "text",
success: function (msg) {
if (msg == "OK") {
alert("删除成功");

}
else {
alert("失败!");
}
}
});

 

 

 还有在  怎么验证年龄的范围范围s

View Code
function validator() {
$.formValidator.initConfig({
formID: "form1",
onSuccess: function () { alert("输入正确") },
onError: function () {
return false;
}

});
$("#StuName").formValidator({
onShow: "请输入汉字",
onFocus: "输入汉字",
onCorrect: "验证通过"

})
.regexValidator({
regExp: "chinese",
dataType: "enum",
onError: "只能输入汉字"
});
$("#StuAge").formValidator({
onShow: "请输入数字",
onFocus: "请输入年龄",
onCorrect: "验证通过"

}).inputValidator({
min: 18,
max: 40,
type: "Value",
onError: "年龄要求不符合"
});
$("#ClassID").formValidator({
onShow: "必须选择",
onFocus: "请选择",
onCorrect: "验证通过"
})
.inputValidator({
type: "size",
min: 1,
onError: "选择错误"
});
$("#StuNo").formValidator({
onShow: "必须输入",
onFocus: "正在输入",
onCorrect: "可以使用"
})
.ajaxValidator({
url: '<%=Url.Action("IsValidator") %>',
datatype: "text",
type: "GET",
success: function (data) {
return data == "error" ? false : true;
},
onError: "已经注册",
onWait: "等待验证..."
});
}

 

posted on 2011-12-04 21:44  菜中菜  阅读(462)  评论(0编辑  收藏  举报