Jquery lets you display the returned content in a specific div with less of code

  • 2020-03-30 03:27:14
  • OfStack

As I wrote before (link: #), I have been watching jquery recently, so I rewrote it with jquery. Jquery is "write less, do more".


<html> 
<head> 
<title></title> 
<script type="text/javascript" src="http://code.jquery.com/jquery-2.1.1.min.js"></script> 
<meta charset="utf-8" /> 
<script> 
$(function(){ 
$("#right").load("test1.php"); 
$("#left").click(function(){ 
$("#right").load("test2.php"); 
return false;//Disable button submission
}); 
}); 

</script> 
</head> 

<body> 
<div id="left"><a href="#"> Click here to </a></div> 
<hr /> 
<div id="right"></div> 
</body> 
</html>

Related articles: