php - Reloading only a div, many different possible links -
i'm inexperienced in jquery. did research , found code should allow me reload div of page:
<script> $(document).ready(function(){ $(".reload").click(function(){ $("#day").load("/some_url #day > *"); }); }); </script>
as can see reload #day when element of class .reload clicked. problem url. page has many different instances of class, each different url. generated in php such:
echo "<div class=\"reload\"><a href=\"index.php?day=$day\" > $day </a></div>";
so i'm no longer sure i'm using correct approach. want when user clicks 1 of links, instead of reloading whole page in link, update #day on current page. each instance of class reload points different link.
try this:
$(".reload a").click(function(event){ event.preventdefault(); var url = $(this).prop('href'); $("#day").load(url + " #day > *"); });
Comments
Post a Comment