Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Get html by ajax

<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>

$(document).ready(function(){
  $("button").click(function(){
    $.ajax({url: "sendHtml.php", success: function(result){
      $("#div1").html(result);
    }});
  });
});

</script>
</head>
<body>

<div id="div1"><h2>Let jQuery AJAX Change This Text</h2></div>

<button>Get External Content</button>

</body>
</html>
 
PREVIOUS NEXT
Tagged: #Get #html #ajax
ADD COMMENT
Topic
Name
9+4 =