June 28, 2025
Ajax jQuery.load method
With jQuery's load method we can get some content (like HTML or text) from another server and show it on our webpage in selected HTML element without reloading the page. With this approach we can update a part of webpage without reloading the entire webpage. It also make our webpage faster because we load content in smaller chunks. Example is mentioned below:
jQuery.load() method example
<html>
<head>
<title>Example</title>
<script src="https://code.jquery.com/jquery-3.6.0.min.js"></script>
</head>
<body>
<div id="boxStudent"></div>
<button id="btnStudent">Student Info</button>
<script>
$("#btnStudent").click(function(){
$("#boxStudent").load("student_info.html");
});
</script>
</body>
</html>