Set an interval which makes a AJAX request to the PHP page, output nothing to the PHP page if you don't want anything displayed. Have JavaScript check the response with an if statement, and if it isn't null alert the reponse.
Set an interval which makes a AJAX request to the PHP page, output nothing to the PHP page if you don't want anything displayed. Have JavaScript check the response with an if statement, and if it isn't null alert the reponse.
kinda quit.
Thats the problem nets.. I have no clue about JS . Never studied it thats why im trying to do this.
I only know advanced PHP.
Most people have havent studied any web programming langages? if youve ever used VB, ASP etc its actualy very simlar syntax, although less like Vb and more like php in other ways "/
it formats alot like php, aka the
bla{
somthing;
somthing;
}
but the varibles are refranced more like vb. Useing the Document Object modle
thisobject.thisproperty.thissubproperty
(sorry for use of persudo code, im lazy)
Anyway, heres a nice 30 second ajax tutoral, to give you the low down on that
http://rajshekhar.net/blog/archives/...-Tutorial.html
and how to call a function at set intervals use setTimeout
t=1
function timedCount()
{
t++ ;
if (t < 5 ) {
t=setTimeout("timedCount()",4000) ;
}
}
timedCount()
var intervalID;
function show()
{
intervalID = setInterval(showHint, 1000);
}
var xmlHttp
function showHint()
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="cfh.php"
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById("txtHint").innerHTML=xmlHt tp.responseText
}
}
function GetXmlHttpObject()
{
var objXMLHttp=null
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
}
I have that to pull the PHP page out. Would that be correct?
var xmlHttp
function showHint()
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
{
alert ("Browser does not support HTTP Request")
return
}
var url="clienthint2.php"
xmlHttp.onreadystatechange=stateChanged
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
var intervalID;
function show()
{
intervalID = setInterval(showHint, 1000);
}
}
function stateChanged()
{
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
{
document.getElementById("txtHint").innerHTML=xmlHt tp.responseText
}
}
function GetXmlHttpObject()
{
var objXMLHttp=null
if (window.XMLHttpRequest)
{
objXMLHttp=new XMLHttpRequest()
}
else if (window.ActiveXObject)
{
objXMLHttp=new ActiveXObject("Microsoft.XMLHTTP")
}
return objXMLHttp
}
This?
Want to hide these adverts? Register an account for free!