How to use jQuery and Ajax to refresh div content? -
i should refresh content of div element clicking on div.
tried using load()
method of jquery, didn't work.
code:
<script> $(document).ready(function(){ $("#click").click(function(){ $("#torefresh").load("articoli.html"); }); }); </script>
and html:
<div class="col-md-8 main-div" id="torefresh"> <h3 class="lato-font" style="color: white;">elenco eventi</h3> <div class="conf-div"> <div class="conf-div-content lato-font text-left"> <div class="conference-div" id="click"> <div class="conference-content"> <img class="role" src="images/roles-icons/chair-active.png"> <img class="role" src="images/roles-icons/author-active.png"> <img class="role" src="images/roles-icons/reviewer-active.png"> <p class="title">conferenza 1</p> <img class="arrow" src="images/arrow-right.svg"> </div> </div> </div> </div> </div>
i tried insert div class="conference-div"
a
element, didn't work. how can fix that?
you can use $.ajax instead of load.
$.ajax({ url: 'articoli.html', cache: false }).done(function( result ){ $('#torefresh').html( result ); });
Comments
Post a Comment