Hi, I want to change a div content with a php file every 5 seconds. I have two php files and I want to change div content with that files alternatively every 5 seconds. I tried some code. But it doesn't works. Can anybody please help me? function firstCall() { $("#divid").load("emails.php"); setTimeout("secondCall()", 5000); } function secondCall() { $("#divid").load("add.php"); setTimeout("firstCall()", 5000); } <body onload="firstCall()"> Thanks in Advance.
this is javascript not php and try function firstCall() { $("#divid").load("emails.php"); setTimeout("secondCall", 5000); } function secondCall() { $("#divid").load("add.php"); setTimeout("firstCall", 5000); } <body onload="firstCall()">
Hi, I tried the code as you said. The first php file loads properly but the second php file is not loaded. I don't know what's the problem with the code.
var current = 1; function call() { if(current % 2 == 0) $("#divid").load("add.php"); else $("#divid").load("emails.php"); current++; setTimeout("call()", 5000); } <body onload="call()"> HTML: