【www.gdgbn.com--jquery】

$.ajax()这个是jquery 的底层 ajax 实现。简单易用的高层实现见 $.get, $.post 等。

这里有几个ajax事件参数:beforesend ,success ,complete ,error 。我们可以定义这些事件来很好的处理我们的每一次的ajax请求。

$.ajax({url: "stat.php教程",

type: "post",

data:{name:"keyun"},

datatype: "html",

timeout: 1000,

error: function(){alert("error loading php document");},

success: function(result){alert(result);}

});

ajax.asp教程x:

response.contenttype = "application/json";response.write("{result: "" + request["name"] + ",你好!(这消息来自服务器)"}");jquery 代码:
$.post("ajax.aspx", { action: "post", name: "lulu" }, function (data, textstatus){ // data 可以是 xmldoc, jsonobj, html, text, 等等. //this; // 这个ajax请求的选项配置信息,请参考jquery.get()说到的this alert(data.result); }, "json");

 

本文来源:http://www.gdgbn.com/wangyezhizuo/29288/