下面是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);
});

随机推荐

  1. ASP.NET 5探险(5):利用AzureAD实现单点登录

    题记:在ASP.NET 5中虽然继续可以沿用ASP.NET Identity来做验证授权,不过也可以很容易集成支持标准协议的第三方服务,比如Azure Active Directory. 其实,在AS ...

  2. 简单解释Windows如何使用FS段寄存器

    详见附件 jpg改rar

  3. php 常见的问题

    1. this指针错误的引用变量($(php)<->*(c)) $this->inputData right wrong 2. json_encode(array) 不一定按数组关键 ...

  4. Linux使用jstat命令查看jvm的GC情况

    Linux使用jstat命令查看jvm的GC情况 http://www.open-open.com/lib/view/open1390916852007.html http://www.aiuxian ...

  5. json 转化

    1. 把java 对象列表转换为json对象数组,并转为字符串 复制代码代码如下:     JSONArray array = JSONArray.fromObject(userlist);    S ...

  6. hdu1003 dp

    题目链接:http://acm.split.hdu.edu.cn/showproblem.php?pid=1003 #include<cstdio> #include<algorit ...

  7. this对象

    this对象   1.纯粹的函数调用 function test(){ this.x = 1; alert(this.x); } test();//1 2.函数作为某个对象的方法进行调用,这是this ...

  8. CSS3-给网页添加图片

    给网页添加图片: 1.background-attachment: scroll--------随文本一块滚动 ; background-attachment: fixed-----固定在一个位置上 ...

  9. zepto下加载openbox弹出层

    function fnOpenBox(objId,animateD,speed,tween,hide){ var oOpenBox = $(objId); oOpenBox.show(); oOpen ...

  10. http://blog.csdn.net/z69183787/article/details/37819831

    http://blog.csdn.net/z69183787/article/details/37819831