asp.net 简单问题 求解
大家好 我想练习个简单的 ajax的登录 但是 老是打不到我想要的结果
但是 朋友的电脑上可以显示 我不知道具体是什么原因造成的 希望大家指点下!谢谢!
Default.aspx中:js
<script type="text/javascript">
var xmlhttp;
var result;
function btn_logn_Clock() {
var userName = document.getElementById("username").value;
var userPwd = document.getElementById("password").value;
xmlhttp = window.XMLHttpRequest ? new XMLHttpRequest() : new ActiveXObject("Microsoft.XMLHTTP");
var data = "username=" + encodeURIComponent(userName)
+ "&password=" + encodeURIComponent(userPwd);
xmlhttp.open("Post", "Default2.aspx", true);
xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
xmlhttp.onreadystatechange = function () {
if (xmlhttp.readyState == 4 && xmlhttp.status == 200) {
result = xmlhttp.responseText;
}
}
xmlhttp.send(data);
}
</script>
protected void Page_Load(object sender, EventArgs e)
{
string userName = string.Empty;
string password = string.Empty;
userName = Request.Form["username"];
password = Request.Form["password"];
Response.Write("姓名:’" + userName + "'<br/> 密码:" + password);
Response.End();
}