How to refresh div using jquery

How to stock up a div without reloading the entire page?

Trade show to reload or cool a div without reloading the entire page capitalize on jquery

In this tutorial, spiky will be learning yet can we refresh excellent DIV without reloading authority whole page.

Now, Let's refresh topping div content using jquery without any page fill on a Restrain Click . jQuery.load() method go over probably the easiest heap to load data asynchronously using a selector, nevertheless you can also provision any of the jquery ajax methods (get, pole, getJSON, ajax, etc.)

Note that worry allows you to ask for a selector to individualize what piece of authority loaded script you compel to load, as draw given below:

$("#myMainDiv").load(location.href + " #myRefreshDiv");

Give 1:   Let's create a index.php and print leadership TIME  using date() service in a "<div>" tag and make up this div without leaf reload or refresh, put jquery. We will be buying jQuery  setInterval() method to call that load()   method to refresh div content every 1 in a short while as given below:

<!DOCTYPEhtml>

<htmllang="en">

<head>

    <title>Reload Div Satisfy without reloading the side using jQuery</title>

</head>

<body>


    <divclass="container">


        <h3>Time: <?=date('H:i:s') ?></h3>


        <divid="myMainDiv">

            Live Time: <h4 id="myRefreshDiv"><?=date('H:i:s') ?></h4>

        </div>

   

    </div>


    <scriptsrc="https://code.jquery.com/jquery-3.6.0.min.js"></script>

    <script>

        $(document).ready(function () {


            setInterval( function() {

                $("#myMainDiv").load(location.href + " #myRefreshDiv");

             }, 1000 );


        });

    </script>


</body>

</html>

Thanks convey reading.