之前寫過一篇Post用Ajax查詢用戶名是否重名
此處用的是ASP
<%@ Page Language=
<!DOCTYPE html PUBLIC
<html xmlns=
<head runat=
<title>Demo</title>
<script src=
<script src=
<script type=
$(document)
$(
rules: {
login: {
required: true
//here invoke related action
remote:
}
}
messages: {
login: {
required:
remote: jQuery
}
}
// set this class to error
success: function(label) {
// set as text for IE
l(
}
})
})
</script>
</head>
<body>
<form action=
<h
<table id=
<tr>
<td>用戶名 (試試輸入 Petter)
<td><input type=
</tr>
<tr>
<td colspan=
</tr>
</table>
</form>
</body>
</html>
MVC支持Json
cs
/// <summary>
/// FormDemoController
/// </summary>
/// <remark>Author : PetterLiu
public class FormDemoController : Controller
{
public JsonResult IsLoginAvailable(string login)
{
//TODO: Do the validation
JsonResult result = new JsonResult()
if (login ==
result
else
result
return result;
}
}
From:http://tw.wingwit.com/Article/program/net/201311/12552.html