refresh a part of webpage in php

ajax, php

Solution

PHP cannot do this, only a client-side language like JavaScript can. That being said, the jQuery library would allow you to do this really easily with its AJAX functionality.

Index.php

<div id="scores"><!-- score data here --></div>

Could be refreshed with the following JavaScript:

$("#scores").load("index.php #scores");

That would load the contents of `#score` from index again without refreshing the entire page.

You could even automate it to refresh every 30 seconds using `setInterval()`;

var $scores = $("#scores");
setInterval(function () {
    $scores.load("index.php #scores");
}, 30000);

You can read more about `$.load()` at http://api.jquery.com/load/#loading-page-fragments.

Problem

i develop a page in that i need to refresh a part of a webpage,not a whole one in php using Ajax. Please help me to do this , thanks in advance

Original source