Most of the examples I have found explain how to refresh a div with text or with another page. I just want to reload the div again after click on a button. How can I do this using javascript?
Thanks.
Most of the examples I have found explain how to refresh a div with text or with another page. I just want to reload the div again after click on a button. How can I do this using javascript?
Thanks.
Please call a ajax function on click of the button and set the innerHTML property of the div with return result.
Any change to the DIV element is stored in the DOM of the page is displayed immediately. You do not need to do anything for that. However, the old state of the DIV after the change is lost. You need to store it somewhere and setup it again to make it visible.
So we just place this little JS code snippet into our page to refresh everything inside the tag with the content id, let’s say every 5 seconds:
With AJAX.
If you use jQuery, it's as simple as
$('#mydiv').load(url)