积极答复者
请教一下!怎么用js把网页上的textbox输入的类容插入到数据库中!

问题
答案
-
-
这是第一个页面中的代码:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script> //引用jquery框架
<script type="text/javascript">
$(function () {
$("#btn1").click(function () {
$.get("1.aspx", { name: $("#TextBox1").val() }, function (data) {alert(data)
});//通过AJAX的GET方式异步提交数据,并回调执行完成后的结果})
})
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<input type="button" id="btn1" value="按钮" />
</div>
</form>
</body>
</html>在第二个页面也就是"1.aspx"的Page_Load中,使用:
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(Request.QueryString["name"]); //Request.QueryString["name"]是用来得到你提交上来的值的。
Response.End();
}
全部回复
-
-
这是第一个页面中的代码:
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
<script src="Scripts/jquery-1.4.1.min.js" type="text/javascript"></script> //引用jquery框架
<script type="text/javascript">
$(function () {
$("#btn1").click(function () {
$.get("1.aspx", { name: $("#TextBox1").val() }, function (data) {alert(data)
});//通过AJAX的GET方式异步提交数据,并回调执行完成后的结果})
})
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<input type="button" id="btn1" value="按钮" />
</div>
</form>
</body>
</html>在第二个页面也就是"1.aspx"的Page_Load中,使用:
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(Request.QueryString["name"]); //Request.QueryString["name"]是用来得到你提交上来的值的。
Response.End();
}