Hi
I am using C# and asp.net with Jquery. I am trying to use Jquery for ajax and as my javascript framework. I am not using the script manager nor do I
plan too.
I am just trying to learn how to do ajax and talk back and forth to the server.
I am finding this very hard to do.
All I am trying to do is this:
1. Have a html sumbit button.2. When the submit button is clicked an ajax event is fired. In this ajax event a hardcoded value gets sent to the server.3. The server grabs that hardcoded value and print it out back to the screen.
I been trying and trying and I can’t get it to work
I tried to do this:
[code]
<%@ 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 src=”jquery.form.js” type=”text/javascript”></script>
<script type=”text/javascript”>
$(function()
{
$(“#submit”).submit(function()
{
$.post(“Default.aspx”, { name: “testagaga” });
});
});
</script>
</head>
<body>
<form id=”form1″ runat=”server” >
<input value=”adaga” type=”text” id=”mytext”/>
<input type=”submit” id=”submit” />
</form>
</body>
</html>
[code]
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 (IsPostBack == true)
{
string test = Request[“name”];
}
}
}