ajax传递一个参数具体实现
(编辑:jimmy 日期: 2024/11/17 浏览:3 次 )
复制代码 代码如下:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="/UploadFiles/2021-04-02/Jquery1.7.js"><script type="text/javascript">
$(function () {
$('#txtUserName').blur(function () {
$.ajax({
type: "post",
contentType: "application/json",
url: "WebService1.asmx/ValidateUser",
data: "{username:'" + $('#txtUserName').val() + "'}",
success: function (result) {
$('#spinfo').text(result.d);
}
})
})
})
</script>
</head>
<body>
<div>
用户名<input type="text" id="txtUserName" /><span id="spinfo"></span><br />
密码<input type="text" id="txtPwd" />
</div>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title></title>
<script src="/UploadFiles/2021-04-02/Jquery1.7.js"><script type="text/javascript">
$(function () {
$('#txtUserName').blur(function () {
$.ajax({
type: "post",
contentType: "application/json",
url: "WebService1.asmx/ValidateUser",
data: "{username:'" + $('#txtUserName').val() + "'}",
success: function (result) {
$('#spinfo').text(result.d);
}
})
})
})
</script>
</head>
<body>
<div>
用户名<input type="text" id="txtUserName" /><span id="spinfo"></span><br />
密码<input type="text" id="txtPwd" />
</div>
</body>
</html>
下一篇:ajax传递多个参数具体实现