I am calling the callAjax function in the HTML body as below :
<center>
<h3>Request Tracking System</h3>
<table width="70%" border=0>
<tr>
<td width=100% valign=top>
<table width=100% cellpadding=8 cellspacing=0 class=bord border=0>
<th colspan=2>
<button type="button" onclick="javascript:callAjax('m');return false;">Requests for me</button>
</th>
<th colspan=2>
<button type="button" onclick="javascript:callAjax('o');return false;">All Requests</button>
</th>
</table>
<br/><br/>
<div id="my_requests" >
</div>
<!--<div id="remove_user_show" style="display:none;">
</td>
</table>
my callAjax function is as follows :
<script language="javascript" type="text/javascript">
function callAjax(type)
{
alert("kk");
var ajaxRequest; // The variable that makes Ajax possible!
var xmlHttpReq = false;
var self = this;
try
{
// Opera 8.0+, Firefox, Safari
//ajaxRequest = new XMLHttpRequest();
self.xmlHttpReq = new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer Browsers
try
{
//ajaxRequest = new ActiveXObject("Msxml2.XMLHTTP");
self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
try
{
//ajaxRequest = new ActiveXObject("Microsoft.XMLHTTP");
self.xmlHttpReq = new ActiveXObject("Microsoft.XMLHTTP");
}
catch (e)
{
// Something went wrong
alert("Your browser broke!");
return false;
}
}
}
// Create a function that will receive data sent from the server
var queryString = "&flag=i&flag2=" + type;
var strUrl = "index.php?mode=home" + queryString;
//window.location.href = strUrl;
self.xmlHttpReq.onreadystatechange = function(){
if(self.xmlHttpReq.readyState == 4 || self.xmlHttpReq.readyState == "complete")
{
document.getElementById('my_requests').innerHTML = self.xmlHttpReq.responseText;
}
}
self.xmlHttpReq.open("GET", strUrl, true);
//self.xmlHttpReq.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
self.xmlHttpReq.send();
}
</script>
please help me ...