Home > Web Front-end > JS Tutorial > ajax-load example

ajax-load example

无忌哥哥
Release: 2018-06-29 15:01:15
Original
1205 people have browsed it

ajax-load instance

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>1.ajax-load()</title>
</head>
<body>
<img src="../images/zly.jpg" width="150">
<div></div>
<button>点击</button>
</body>
</html>
<script type="text/javascript" src="../js/jquery-3.3.1.js"></script>
<script type="text/javascript">
$(&#39;button&#39;).eq(0).on(&#39;click&#39;,function(){
$(&#39;div&#39;).eq(0)
// .load(&#39;api/info.php&#39;)
// .load(&#39;api/info.php&#39;+&#39; p&#39;)  //支持选择器
// .load(&#39;api/info.php&#39;+&#39; h3&#39;)
// .load(&#39;api/info.php&#39;,{birthday:&#39;10月16日&#39;,nation:"中国"}) //POST
// .load(&#39;api/info.php&#39;,&#39;age=31&sex=女&#39;) //GET
.load(&#39;api/info.php&#39;,&#39;age=31&sex=女&#39;,function(){
$(&#39;img&#39;).css(&#39;border-radius&#39;,&#39;50%&#39;)
}) //callBack()
})
</script>
Copy after login

The above is the detailed content of ajax-load example. For more information, please follow other related articles on the PHP Chinese website!

source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template