AJAX with jQuery

<button id="loadData">Load Data</button>
<div id="result"></div>

<script>
$(document).ready(function(){
  $("#loadData").click(function(){
$("#result").load("sample.txt");
}); }); </script>

.load("file.txt") fetches and displays external content without refreshing the page.

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *