jquery ajax
来源:互联网 发布:淘宝授权管理在哪里 编辑:程序博客网 时间:2024/06/06 07:46
<script>
$(document).ready(function(){
$("#btn1").click(function(){
$('#test').load('/example/jquery/demo_test.txt');
})
})
$(document).ready(function(){
$("#btn1").click(function(){
$('#test').load('/example/jquery/demo_test.txt');
})
})
</script>
$(selector).load(URL,data,callback);
- responseTxt - 包含调用成功时的结果内容
- statusTXT - 包含调用的状态
- xhr - 包含 XMLHttpRequest 对象
下面的例子会在 load() 方法完成后显示一个提示框。如果 load() 方法已成功,则显示“外部内容加载成功!”,而如果失败,则显示错误消息:
实例
$("button").click(function(){ $("#div1").load("demo_test.txt",function(responseTxt,statusTxt,xhr){ if(statusTxt=="success") alert("外部内容加载成功!"); if(statusTxt=="error") alert("Error: "+xhr.status+": "+xhr.statusText); });});
jQuery get() 和 post() 方法用于通过 HTTP GET 或 POST 请求从服务器请求数据。
- GET - 从指定的资源请求数据
- POST - 向指定的资源提交要处理的数据
$("button").click(function(){ $.get("demo_test.asp",function(data,status){ alert("Data: " + data + "\nStatus: " + status); });});
$("button").click(function(){ $.post("demo_test_post.asp", { name:"Donald Duck", city:"Duckburg" }, function(data,status){ alert("Data: " + data + "\nStatus: " + status); });});
- jquery ajax
- jquery ajax
- AJAX jquery
- ajax jquery
- AJAX + jQuery
- jquery.ajax
- Jquery Ajax
- jquery ajax
- Jquery+ajax
- jquery ajax
- jquery ajax
- jquery ajax
- jQuery ajax
- JQuery ajax
- jquery ajax
- jquery ajax
- jQuery Ajax
- Jquery ajax
- MFC中菜单的一些操作
- oracle 删除
- MFC Menu
- 统一编址和独立编址
- 基于物品的协同过滤推荐算法——读“Item-Based Collaborative Filtering Recommendation Algorithms” .
- jquery ajax
- Code Snip:如何使Splash Form初始过渡页的时间长一点?
- 超过 130 个你需要了解的 vim 命令
- MFC制作右键弹出菜单 指定位置
- LeetCode - Plus One
- 那些年…上过的女孩
- 关于消息队列的使用
- 各种常见编码的转换算法
- 常见的内存错误