[jQuery] run part of my jquery code after a postback

[jQuery] run part of my jquery code after a postback


Hi
I am building an asp.net web application using visual studio 2008
with .NET 3.5 on Windows XP 32 bit machine where I have the server as
well. C# and javascript are used.
There is contactUs.aspx, once the form is submitted successfully, I
want to run the jQuery in the contactUs.js file starting from line 20
(var dataString = 'name=' + name + '&email=' + emailWink to
line 40 (return falseWink.
How do I wire it up.
contactUs.aspx.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
public partial class contactUs : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
}
protected void Button1_Click(object sender, EventArgs e)
{
try
{
totalCareAutoTableAdapters.ContactUsTableAdapter
ContactUsAdapter = new totalCareAutoTableAdapters.ContactUsTableAdapter
();
int new_ContactUs = Convert.ToInt32
(ContactUsAdapter.InsertContactUs(name.Text, mobileNumber.Text,
emailAddr.Text, subjectTitle.Text, messege.Text));
}
catch (Exception ex)
{
}
}
}
contactUs.js
/// <reference path="jquery-1.3.2-vsdoc2.js" />
$(function()
{
$('.error').hide();
$(".button").click(function()
{
// validate and process form here
$('.error').hide();
var name = $("[id$='name']").val();
var email = $("[id$='emailAddr']").val();
if (name == "")
{
$("[id$='name_error']").show();
$("[id$='name']").focus();
return false;
}
var dataString = 'name=' + name + '&email=' + email;
$.ajax({
type: "POST",
url: "siteMap.aspx",
data: dataString,
success: function()
{
$("[id$='contact_form']").html("<div
id='message'></div>");
$("[id$='message']").html("<h2>Contact
Form Submitted!</h2>")
.append("<p>We will be in touch
soon.</p>")
.hide()
.fadeIn(1500, function()
{
$("[id$='message']").append("<img
id='checkmark' src='images/fiat.jpeg' />");
});
}
});
return false;
});
});