Jump to content

nj

New Members
  • Posts

    4
  • Joined

  • Last visited

    Never

Profile Information

  • Gender
    Not Telling

nj's Achievements

Newbie

Newbie (1/5)

0

Reputation

  1. nj

    reload

    I have reviewed my code, also check this function:- function displayTime(){ if(xmlhttp.readyState == 4 || xmlhttp.readyState == 'complete'){ document.getElementById('time').innerHTML = http.responseText; } } replace it with function displayTime(){ if(xmlhttp.readyState == 4 || xmlhttp.readyState == 'complete'){ document.getElementById('time').innerHTML = xmlhttp.responseText; } }
  2. nj

    reload

    The reason why it doesn't working is one, may be the php code is in the same page with the client page. This two must be sepated as in the php code should be named time.php and the client page say client.php. let this two be on the same folder. Two, try writting a simple code in php for testing before getting to the real thing. like <?php $time = date(); echo $time; ?> save this as time.php and test with it. if it works check your php code.
  3. Hi guys, I have this problem with setInterval and internet explorer, Am using Ajax to request data from the DB and display it on div in the clients page. This process is repeated every one minute using the setInterval function. My code works well in all other browsers except internet explorer, can someone help me work this around in internet explorer. javascript:void(0); I did not include my code coz its kind of long.
  4. nj

    reload

    Hi rashmi_k28 , Am new in php, but am good at ajax, Try this, Save this code as a new php page and call it time.php or any other name. <? $name = Names(1); array_shift($name); $time_val = $name[0]; // make sure u echo $time_val echo $time_val; ?> now, do this to the page that is viewed by the client <html> <head> <script type="text/javascript"> var xmlhttp; function getHTTPObject() { xmlhttp = null; try{ xmlhttp = new XMLHttpRequest(); } catch(e){ try{ xmlhttp = new ActiveXObject('Msxml.XMLHTTP'); } catch(e){ xmlhttp = new ActiveXObject('Microsoft.XMLHTTP'); } } return xmlhttp; } function changeDiv(){ xmlhttp = getHTTPObject(); if(xmlhttp == null){ alert('Browser does not support HTTP Requests'); return; } var url = "time.php"; xmlhttp.onreadystatechange = displayTime; xmlhttp.open("GET", url, true); xmlhttp.send(null); } function displayTime(){ if(xmlhttp.readyState == 4 || xmlhttp.readyState == 'complete'){ document.getElementById('time').innerHTML = http.responseText; } } function timing(){ window.setInterval("changeDiv()",60000); } </script> </head> <body onload="timing()"> <div id="time"></div> </body> Try it.
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.