-
function ajaxRequest()
-
{
-
var opt = ‘s=whatever you want to pass’;
-
var page = ‘ajax_page.php’;
-
var http = createRequestObject();
-
http.onreadystatechange = function()
-
{
-
if((http.readyState == 4) && (http.status == 200))
-
{
-
var text = http.responseText;
-
}
-
}
-
http.open(‘POST’, page, true);
-
http.setRequestHeader(“Content-type”, “application/x-www-form-urlencoded”);
-
http.setRequestHeader(“Content-length”, opt.length);
-
http.setRequestHeader(“Connection”, “close”);
-
http.send(opt);
-
}
Note
Handles response from an ajax request.