Possible Duplicate:
get values on server-side sent with xmlHttp.open(GET
Get value from AJAX using Javascript and ASP
I have two values ( numbers ) on the client side ASP javascript that I want to send to the server-side asp javascript. so my code is this: ( client side )
function receiveResult(_data,nbquestions)
{
//alert(nbquestions)
//alert(_data)
var xmlHttp;
try
{
/* Firefox, opera */
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
/* IE 9 */
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
/* IE 6.x-8*/
try
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
alert("Your browser is old please update it !");
return false ;
}
}
}
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
/* this puts the value into an alert */
}
}
// send querystring to the server-side
xmlHttp.open("post","CmsAjax.asp",true)
xmlHttp.send("param1="+_data+"¶m2="+nbquestions);
}
I have two questions:
Is the xmlHttp.send correctly written?
How do I get the values on the server-side using JavaScript?