欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

jQuery中通過ajax的get()函數(shù)讀取頁面的方法

 更新時間:2016年02月29日 21:45:27   投稿:mdxy-dxy  
這篇文章主要介紹了jQuery中通過ajax的get()函數(shù)讀取頁面的方法,需要的朋友可以參考下

首先介紹get()函數(shù):

url,[data],[callback],[type]


參數(shù)說明:
url:待載入頁面的URL地址
data:待發(fā)送 Key/value 參數(shù)。
callback:載入成功時回調(diào)函數(shù)。
type:返回內(nèi)容格式,xml, html, script, json, text, _default。
首先建立testGet.php實例:

<?php
$web = $_GET['webname'];
echo "你現(xiàn)在訪問的網(wǎng)站是:".$web;
?>

然見建立ajax.html文件:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>php點點通 - 關(guān)注php開發(fā),提供專業(yè)web開發(fā)教程! </title>
<script type="text/javascript" src="./jquery-1.7.1.min.js"></script>
<script>
	$(document).ready(function(){
		$("#btn").click(function(){
			$.get("testGet.php",{web:"www.phpddt.com"},function(data,textStatus){
				$("#result").append("data:"+data);
				$("#result").append("<br>textStatus:"+textStatus);
			});		
		});
	});
</script>
</head>
<body>
<input type="button" value="測試" id="btn" />
<h2>顯示的內(nèi)容如下:</h2>
<div id="result"></div>
</body>
</html>

測試前的初始頁面是:

點擊測試后的結(jié)果是:

相關(guān)文章

最新評論