stephenalistoun
12-30-2008, 09:15 PM
Hi all,
I'm quite new to AJAX and I cannot display data from the file called getcd.php.
Could you guys please help me.
<script>
var xmlHttp
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
function showCD()
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="checkUpdate.php"
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
setTimeout("showCD()",1000);
}
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
if(xmlHttp.responseText > 0)
{
/********I'm Stuck somewhere here*********/
xmlHttp2=GetXmlHttpObject()
if (xmlHttp2==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="getcd.php"
xmlHttp2.open("GET",url,true)
xmlHttp2.send(null)
document.getElementById("txtHint").innerHTML = xmlHttp2.responseText
}
}
}
</script>
Thanks
Stephen
I'm quite new to AJAX and I cannot display data from the file called getcd.php.
Could you guys please help me.
<script>
var xmlHttp
function GetXmlHttpObject()
{
var xmlHttp=null;
try
{
// Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{
// Internet Explorer
try
{
xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
}
catch (e)
{
xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
}
}
return xmlHttp;
}
function showCD()
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="checkUpdate.php"
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
setTimeout("showCD()",1000);
}
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
if(xmlHttp.responseText > 0)
{
/********I'm Stuck somewhere here*********/
xmlHttp2=GetXmlHttpObject()
if (xmlHttp2==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="getcd.php"
xmlHttp2.open("GET",url,true)
xmlHttp2.send(null)
document.getElementById("txtHint").innerHTML = xmlHttp2.responseText
}
}
}
</script>
Thanks
Stephen