jQuery ajax() Load text from ajax

Description

jQuery ajax() Load text from ajax

View in separate window

<!DOCTYPE html>
<html>
<head>
<script 
 src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js">
</script>//from w  w w  .j av  a2s  . co m
<script>
$(document).ready(function(){
  $("button").click(function(){
    $.ajax({url: "ajax.txt", async: false, success: function(result){
      $("div").html(result);
    }});
  });
});
</script>
</head>
<body>

<div><h2>Here</h2></div>

<button>Change Content</button>

</body>
</html>



PreviousNext

Related