Refresh a div with php data every 10 seconds using jQuery Refresh a div with php data every 10 seconds using jQuery php php

Refresh a div with php data every 10 seconds using jQuery


jQuery load method works in a different way. Try reading its documentation.

You don't have to specify destination element ID twice, remove the second one, like this:

$("#latestData").load("getLatestData.php");


Here's a way that will solve what you want to achieve, using the $.get method in jQuery:

$(document).ready(function () {    setInterval(function() {        $.get("getLatestData.php", function (result) {            $('#latestData').html(result);        });    }, 10000);});


If you want to refresh message count just use this code:

$(document).ready(function () {    setInterval(function () {        $("#ID").load();    }, 1000);});