Home >Web Front-end >JS Tutorial >jquery allows the returned content to be displayed in a specific div (less and concise code)_jquery

jquery allows the returned content to be displayed in a specific div (less and concise code)_jquery

WBOY
WBOYOriginal
2016-05-16 16:43:311094browse

I wrote beforeajax allows the returned content to be displayed in a specific divI was looking at jquery recently, so I re-wrote it using jquery. jquery really means "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;//禁止按钮提交 
}); 
}); 

</script> 
</head> 

<body> 
<div id="left"><a href="#">点击这里</a></div> 
<hr /> 
<div id="right"></div> 
</body> 
</html>
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn