62,244
社区成员




private static TextBox gr
protected void Page_Load(object sender, EventArgs e)
{
gr = TextBox1;
}
[WebMethod]
public static string Get()
{
gr.Text = "1111";
return "";
}
function ad() {
$.ajax({
type: "post",
url: "WebForm2.aspx/Get",
data: "{}",
cache: false,
contentType: "application/json;utf-8",
dataType: "json",
success: function (data) {
//
}
});
}
<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title></title>
<script src="jquery-1.9.1.min.js"></script>
<script>
function ad() {
$.ajax({
type: "post",
url: "WebForm2.aspx/Get",
data: "{}",
cache: false,
contentType: "application/json;utf-8",
dataType: "json",
success: function (data) {
}
});
}
</script>
</head>
<body>
<form id="form1" runat="server">
<a href="#" onclick="ad()">dasdwqeq</a>
<asp:TextBox ID="TextBox1" runat="server" Text="ddd"></asp:TextBox>
</form>
</body>
</html>
这个怎么知道ajax包含的区域在哪
private static TextBox gr;
protected void Page_Load(object sender, EventArgs e)
{
p = this;
gr = TextBox1;
inti();
}
private static void inti()
{
gr.Text = "111111";
}
我这样是可以给控件赋值的