Please see below code:
In Javascript
function CallAJAX()
{
var xhr = new XMLHttpRequest();
var parameters = "name=XXX"+"& Age=20";
xhr.open("POST","page_2.aspx",true);
xhr.send(parameters);
if (xhr.readyState==4)
{
if (xhr.status==200)
{
alert(xhr.responseText);
}
else
{
alert("Problem retrieving XML data");
}
}
}
In Code-Behind(Page2.apsx)
protected void Page_Load(object sender, EventArgs e)
{
Response.Cache.SetCacheability(HttpCacheability.NoCache);
if (Request.Form["name"] != null)
{
string temp = Request.Form["name"];
Response.Write(DateTime.Now.ToShortTimeString());
Response.End();
}
}