110,500
社区成员
发帖
与我相关
我的任务
分享
/// <reference path="jquery-1.4.1-vsdoc.js" />
function checkLogin() {
$.ajax({
type: "GET",
url: "doUser.aspx",
data: "loginId=" + $("#txtLoginId").val(),
dataType: "html",
success: function(msg) {
$("#login").html(msg);
}
});
}
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
namespace Web
{
public partial class doUser : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
UserService us = new UserService();
string loginId = Request.QueryString["loginId"].ToString();
Web.User user = us.GetUserByLoginId(loginId);
if (user != null)
{
Response.Write("该用户名已注册");
}
else
{
Response.Write("该用户名可以使用");
}
}
}
}
<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="Web.WebForm1" %>
<!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 runat="server">
<title></title>
<script src="jquery-1.4.1-vsdoc.js" type="text/javascript"></script>
</head>
<body>
<div>
<input id="txtLoginId" type="text" /><input type="button" value="查看用户名是否存在" id="btn"
onclick="checkLogin();" />
<div id="login">
</div>
</div>
</body>
</html>
报的错是:
网页错误详细信息
消息: 缺少对象
行: 15
字符: 1
代码: 0
URI: http://localhost:3563/WebForm1.aspx
这里行15指的是<div id="login">
调试报的错是:onclick="checkLogin();"