<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!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>
<link type="text/css" href="css/style.css" rel="Stylesheet" />
<script src="javascript/jquery-1.2.6.min.js" type="text/javascript" language="javascript"></script>
<script src="javascript/userName.js" type="text/javascript" language="javascript"></script></head>
<body>
请输入用户名:<input type="text" id="userName" class="userText"/> <input type="button" value="校验" id="Btnws" />
<div id="result"></div>
</body>
</html>$(document).ready(
function(){
$("#Btnws").click(
function(){
var userName= $("#userName").val();
if(userName == ""){
alert("用户名不能为空");
}else{
$.post("Default2.aspx",{Action:"post",Qwe: $("#userName").val()},
function(data, textStatus)
{
alert(data.result);
},
"json");
}
}
);
$("#userName").keyup(
function(){
var value = $(this).val();
if(value==""){
$(this).addClass("userText");
}else{
$(this).removeClass("userText");
}
});
}
);Default2.aspxusing System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Web.UI.HtmlControls;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string a = "";
string w = Request.QueryString[""].ToString();
if (w == "ws")
{
a = "result:'ws'";
}
else
{
a = "result:'sw'";
}
Response.ContentType = "application/json";
Response.Write("{"+a+"}");
}
}
为什么我点击按钮后没有反映呢?
<head runat="server">
<title>无标题页</title>
<link type="text/css" href="css/style.css" rel="Stylesheet" />
<script src="javascript/jquery-1.2.6.min.js" type="text/javascript" language="javascript"></script>
<script src="javascript/userName.js" type="text/javascript" language="javascript"></script></head>
<body>
请输入用户名:<input type="text" id="userName" class="userText"/> <input type="button" value="校验" id="Btnws" />
<div id="result"></div>
</body>
</html>$(document).ready(
function(){
$("#Btnws").click(
function(){
var userName= $("#userName").val();
if(userName == ""){
alert("用户名不能为空");
}else{
$.post("Default2.aspx",{Action:"post",Qwe: $("#userName").val()},
function(data, textStatus)
{
alert(data.result);
},
"json");
}
}
);
$("#userName").keyup(
function(){
var value = $(this).val();
if(value==""){
$(this).addClass("userText");
}else{
$(this).removeClass("userText");
}
});
}
);Default2.aspxusing System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Web.UI.HtmlControls;
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string a = "";
string w = Request.QueryString[""].ToString();
if (w == "ws")
{
a = "result:'ws'";
}
else
{
a = "result:'sw'";
}
Response.ContentType = "application/json";
Response.Write("{"+a+"}");
}
}
为什么我点击按钮后没有反映呢?
public partial class Default2 : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
string a = "";
string w = Request["Qwe"];
if (w == "ws")
{
a = "result:'ws'";
}
else
{
a = "result:'sw'";
}
Response.ContentType = "application/json";
Response.Write("{"+a+"}");
}
}发错了Default2.aspx.cs
不管用了,是什么意思? POST取值就是这样的啊