user3315726
user3315726

Reputation: 13

Refresh DIV only every 5 seconds with JavaScript/PHP

I have been googling about this issue for my messaging system with PHP and MySQL. I cannot work out how to refresh just the div that contains the messages so it can be updated every five seconds without using jquery or AJAX. I don't want to use these because I want the website to be compatible with pretty much anything (i.e. phone, tablet, computer even e-reader browser).

Is it possible to do this with HTML, PHP or JavaScript, and if so, how?

Upvotes: 0

Views: 471

Answers (2)

propeller
propeller

Reputation: 385

You can use an iframe with reloading to a url to a PHP page to get that effect without AJAX. I don't think iframe is more supported than AJAX, though.

Upvotes: 0

silk_route11
silk_route11

Reputation: 344

I guess you are using php to get content from back end. You can use $('#idOfdiv').load("somePHPscriptToUpdateDiv.php") inside setTimeOut(function(){},5000)

Upvotes: 2

Related Questions