I made a test page with one button on it. All I want is when the button is pressed it goes to the server captures the value and spits it backout.
How can I do this?
Here is my code you can even run it.
<%@ 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>
<script src="jquery-1.2.6.
js" type="text/javascript"></script>
<script type="text/javascript">
$("#submit").click(function()
{
$.post("Default.aspx", {SendMe: "send"});
});
</script>
</head>
<body>
<form id="form1" runat="server">
<div>
<input type="submit" value="submit" id="save" />
</div>
</form>
</body>
</html>
code behind
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class _Default : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
if (Request.HttpMethod == "POST")
{
string text = Request.Form["SendMe"];
Response.Output.WriteLine(text);
}
}
}
You just need to get jquery from the jquery site.