$.ajax等相关用法
下面是jquery一些方法的相关用法:
$.ajax:
$.ajax({
type: "GET",
url: "url",
data: {username:$("#username").val(), content:$("#content").val()},
// data: "username=" + $("#username").val()+ "&content=" + $("#content").val()",
contentType: "application/json; charset=utf-8",
dataType: "json",
success: function (data) {
// Play with returned data in JSON format
},
error: function (msg) {
alert(msg);
}
});
$.getJSON:
$.getJSON(
"url",
{ name: "zero", time: "2pm" },
function(json){
alert("JSON Data:");
});
$.post:
$.post("url", { "func": "func" },
function(data){
alert(data.name);
console.log(data.time); // 2pm
}, "json");
$.get:
$.get("url", { name: "zero"},
function(data){
alert("Data Loaded: " + data);
});
随机推荐
- 数据结构之图 Part3 – 1 遍历
DFS using System; using System.Collections.Generic; using System.Linq; using System.Text; namespace ...
- NS 802.11函数分析(一)
recv函数有两个作用,不仅是接收其他节点发送的包,而且当节点接收到其他包的时候也会调用recv() 首先给出NS2中recv的源码,和一些注释: void Mac802_11::recv(Packe ...
- [Linux] 取得服务器版本
1) 登录到服务器执行 lsb_release -a ,即可列出所有版本信息,例如: [root@3.5.5Biz-46 ~]# lsb_release -a LSB Version: 1.3 Dis ...
- 自己制作QQ空间音乐的具体方法
1.打开QQ邮箱找到左栏下方的“文件中转站”--点击收藏文件--上传到收藏 将MP3或WMA音乐文件上传 上传完成点下载 下图: 2.点“保存”将最上面一排的地址全部复制 下图 3.为了更 ...
- Effective C++ 之 Item 5:了解C++默默编写并调用哪些函数
Effective C++ chapter 2. 构造 / 析构 / 赋值运算 (Constructors, Destructors, and Assignment Operators) Item 5 ...
- visio调整画布大小和旋转画布(转)
1.调整画布大小: 鼠标移至画布边界(注意不能是顶点附近),按下ctrl,就会出现双向箭头,拖动鼠标即能调整画布大小. 2.旋转画布: 鼠标移至画布顶点或附近,按下ctrl, 出现单箭头优弧,移动鼠标 ...
- HTML Entity Sets - All
http://www.htmlentities.com/html/entities/ The view below displays the characters used in the offici ...
- 遍历注册表回调函数(仿PCHunter CmpBack)
遍历注册表回调函数(仿PCHunter CmpBack) typedef struct _CAPTURE_REGISTRY_MANAGER { PDEVICE_OBJECT deviceObject; ...
- Arduino101学习笔记(四)—— 数字IO
1.设置管脚模式 //***************************************************************************************** ...
- View(三)
大家在平时使用View的时候都会发现它是有状态的,比如说有一个按钮,普通状态下是一种效果,但是当手指按下的时候就会变成另外一种效果,这样才会给人产生一种点击了按钮的感觉.当然了,这种效果相信几乎所有的 ...