Two Button Clicks don't work when triggered at regular interval by JavaScript function

The app is a chat room with two gridviews: one showing chats and the other showing users online. Now, to check for updates in both I have the following JavaScript functions, with the refresh function called at body's onload event:-

function refresh() { setInterval(call, 100); } function call() { if (document.getElementById("DivChats").innerHTML == "Yes") { document.getElementById("Panel1").scrollTop = document.getElementById("Panel1").scrollHeight; } document.getElementById("lbl_divs_refresh").click(); document.getElementById("btn_users_refresh").click(); }

Now, the two of them doesn't update simultaneously. btn_users_refresh button is being clicked, but lbl_divs_refresh button is not. If I remove btn_users_refresh button then the other one works just fine. Any suggestion how to trigger both the button click events at regular interval simultaneously?

Addressing the "possible duplicate": Server side functions can only be called from client side when they are static, but I have some non-static functions that need to be called from client side

Category:javascript Views:1 Time:2018-05-14
Tags: javascript

Related post

Copyright (C), All Rights Reserved.

processed in 0.144 (s). 11 q(s)