try this........
function ajax()
{
var xmlhttp;
try
{
xmlhttp=new XMLHttpRequest();
}
catch (e)
{
try
{
xmlhttp=new ActiveXObject('Msxml2.XMLHTTP');
}
catch (e)
{
try
{
xmlhttp=new ActiveXObject('Microsoft.XMLHTTP');
}
catch (e)
{
alert('No AJAX support!');
return false;
}
}
}
return xmlhttp;
}
var http = ajax();
var url ='index.php';
var params = 'mode=rot13&string=test';
function handler()
{
if (http.readystate==4 && http.status==200)
{
document.form.string.value = http.responseText;
}
}
function post()
{
http.open('POST', 'index.php', true);
http.setRequestHeader('Content-type', 'application/x-www-form-urlencoded');
http.setRequestHeader('Content-length', params.length);
http.setRequestHeader('Connection', 'close');
http.onreadystatechange = handler;
http.send(params);
}