You can use jQuery’s load
method to refresh a specific division (Div) of a web page without reloading the entire page.
Here’s an example:
In this example, when the button with an ID of refreshButton
is clicked, the division with an ID of myDiv
will be reloaded with updated content from the same URL. The location.href
property is used to get the current URL of the page, and the #myDiv
at the end specifies that only the division with the ID myDiv
should be loaded, not the entire page.
Note that in order to use this script, you need to have jQuery included in your HTML file. You can include it by adding the following code to the <head>
section of your HTML file:
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>