I have a button StartMonitor ,and after user pressing this button, I will start checking current available memory every 5 minutes. That means the view should be updated every 5 minutes to show all the data got so far. I can get the data , but I have no idea how to update the view. What would you recommend?Thanks.
I have a button StartMonitor ,and after user pressing this button, I will start
Share
You will have to actively poll this from the client. After the view has rendered, the connection to the client is lost. You can not, from the server side, push information to the browser.
Use JavaScript or a Meta-Tag with “reload” to reload the view every 5 minutes. For example
If you reload the entire page (either via JS or the Meta-Tag) and the reload does not succeed (e.g. Server Busy Error) your reload code is no longer executed, because the browser now shows an error page not containing your reload-code. For example
I suggest, update a div using AJAX and handle the error event yourself (ignore it, retry, inform the user. whatever fits your needs). That should be a rubust solution.