Refresh html element

Hi,

I have an html element (a chart) on my page and it show the chart based on values from database when I hit a button. Once the page is loaded and when I hit the button the chart shows bars (it’s a bar chart) correctly and when I change the values and hit the button once again,

  1. Chart doesn’t get updated automatically - It is updated only when I hover the mouse over it and that too…
  2. If there are less items to be shown in the chart then the bars gets removed but the items/values on X and Y axis remains there. If there are more items to be shown in the chart then new bars are not being added to it.

Is there a way to refresh/reload html element every time I hit the button and will this fix the issue I have?

Thank you.

Hi,

You will probably find this post helpful.

There was an example provided in this post on how to refresh your iFrame every few seconds but you can change it to suit your needs.

You can take it out of the pages onReady function so that it does not run when the page loads and then you can add it to a button onClick event handler function and adjust the code.

Hope this helps!

Dara | Corvid Team

Thanks for your response but the links didn’t help.

I tried the following two codes even though I knew this is not what I am supposed to do.

setInterval(function () {

                    $w('#html1').postMessage(data);

                }, 5000);

and

setTimeout(function () {

                    $w('#html1').postMessage(data);

                }, 5000);

Can anyone help on this, please?