A Load () method (simplest)
Load (Url,[data],[callback])
URL: Loaded page address
Data: Optional, sent to the server, the format is Key/value
Callback: Optional, callback function
1. The simplest application
Copy Code code as follows:
<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">
<meta http-equiv= "Content-type" content= "text/html; Charset=utf-8 "/>
Application of <title>load Method </title>
<script type= "Text/javascript" src= "Js/jquery-1.8.2.min.js" ></script>
<style type= "Text/css" >
#divframe {border:1px solid #999; width:500px; margin:0 Auto;}
. loadtitle{background: #CCC; height:30px;}
</style>
<script type= "Text/javascript" >
$ (function () {
$ ("#btn"). Click (function () {
Load Entire page
$ ("#ajaxTip"). Load ("inclue_a.html");
Load an element from a page
$ ("#ajaxTip"). Load ("inclue_a.html #userinfo");
})
})
</script>
<body>
<div id= "Divframe" >
<div class= "Loadtitle" >
<input type= "button" value= "Fetch data" id= "BTN"/>
</div>
<div id= "Ajaxtip" >
</div>
</div>
</body>
Where the inclue_a.html code is as follows:
Copy Code code as follows:
<div id= "UserInfo" >
Name: Ice cream <br>
Sex: Tian <br>
Email: 999@123.com
</div>
Show Results:
Click on the button to display the following:
Two Get () method
Three Post () method
Four Ajax () method