首先介绍get()函数:
url,[data],[callback],[type]
参数说明:
url:待载入页面的URL地址
data:待发送 Key/value 参数。
callback:载入成功时回调函数。
type:返回内容格式,xml, html, script, json, text, _default。
首先建立testGet.php实例:
<?php $web = $_GET['webname']; echo "你现在访问的网站是:".$web; ?>
然见建立ajax.html文件:
<html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title> PHP </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>显示的内容如下:</h2> <p id="result"></p> </body> </html>
相信看了本文案例你已经掌握了方法,更多精彩请关注php中文网其它相关文章!
推荐阅读:
ajax读取properties步骤详解
以上就是jQuery+ajax使用get()函数读取页面步骤详解的详细内容,更多请关注php中文网其它相关文章!
![php中文网最新课程二维码](/static/images/article_wechat2021.jpg?1111)
声明:本文原创发布php中文网,转载请注明出处,感谢您的尊重!如有疑问,请联系admin@php.cn处理
- 上一篇:ajax读取properties步骤详解
- 下一篇:AJAX请求队列使用详解
网友评论
文明上网理性发言,请遵守 新闻评论服务协议
我要评论