jQuery/AJAX - Load content into a div when button clicked?
Use jQuery.click
and jQuery.load
:
$(document).ready(function(){
$('.classloader.').click(function(){
$('#contenthere').load('/includes/about-info.html');
});
})
Load latest version of jQuery:
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>
jQuery code:
<script language="javascript">
$(function(){
$(".classloader").click(function(){
$("#contenthere").load("/includes/about-info.html");
});
});
</script>
HTML code:
<p class="classloader">Click Here</p>
<div id="contenthere"></div>