jquery ajax
来源:互联网 发布:网络有重名怎么恢复 编辑:程序博客网 时间:2024/06/11 06:19
load
可以加载静态页面,也可发送get,post请求,主要用来加在静态文件
格式:load(url,data,callback)
例子:load(“text.html”,{param:1},function(response,status,xhr){})
1,response是返回的内容
2,status返回success和error,判断请求成功与否
3,xhr是一个对象,里面封装了一些属性,例如responseText(作用和response一样的)
4,xhr.status返回的是状态码,比如200,404,500等;
5,xhr.statusTest,返回ok等
6,response和status这两个属性比较重要,所以才单独提出来,方便使用
会根据传参的方式自动转化成get或post方式,所以前端要和后台协商好
$(“input”).load(“url?param=1”); 请求url的内容,以get方式发送param
$(“input”).load(“url .class”); 请求url的内容,进行过滤,只要.class
$(“input”).load(“url”,{param:1}); 请求url的内容,以post方式发送param
Get
..
格式:get(url,data,callback,type)
例子子:
get(“text.html?param=1”,function(response,stutas,xhr){})
get(“text.html”,”param=1”,function(response,stutas,xhr){})
get(“text.html”,{param:”1”},function(response,stutas,xhr){})
Post
有一个type属性,规定了返回属性的类型,默认是html
格式:post(url,data,callback,type)
例子子:
post(“text.html”,”param=1”,function(response,stutas,xhr){})
post(“text.html”,{param:”1”},function(response,stutas,xhr){})
阅读全文
0 0
- 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
- 我如何让软件二次开发变简单
- 使用jdcloud-wui筋斗云前端框架如何快速定位到源码
- Android studio 制作.9图片步骤
- 使用BadBoy录制JMeter脚本
- dp入门与两个基础的背包问题
- jquery ajax
- Redis做消息队列文章两篇
- Spark Shuffle之Sort Shuffle
- tableView局部刷新
- Linux下磁盘分区和目录的关系
- 重映射、仿射变换、直方图均衡化
- Android App框架设计 基类BaseActivity
- 等保-国家标准化管理委员会批准18项信息安全技术国家标准
- 手机端定位获取用户位置信息