0

i want to refresh multiple div value without refreshing the whole page using one function.

<div class="live_update" id="a">33</div > <div class="live_update" id="b">34</div > <script src="https://code.jquery.com/jquery-3.1.1.min.js"></script> <script>
    function autoRefresh_div()
    {
        $('.live_update').load('Dashboard.php' +  ' .live_update');
    }
    setInterval('autoRefresh_div()', 1000); 
</script>

Edited by Shafi_2

2
Contributors
1
Reply
27
Views
6 Months
Discussion Span
Last Post by Dani
0

Hello there and welcome to DaniWeb!

So let's see ... You have two div.live_update divs, each with a different id. And now, every second, you want to call the autoRefresh_div() function. As far as I'm aware (at least this is the way I do it), I don't put the parentheses in the setInterval function. So in other words I believe it should be setInterval('autoRefresh_div', 1000). That's the first thing I see.

So now the second thing is inside the function, I'm not quite sure what you're trying to do. You want to load the contents of the webpage 'Dashboard.php.live_update' and tstick those results into both divs? I'm confused what you're trying to do there.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.