最新下载
热门教程
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
jquery AJAX $.post $.get用法
时间:2010-08-23 编辑:简简单单 来源:一聚教程网
jquery代码ajax
jquery.post("newdoajax.asp教程x", { max: ' n !', name: 'wsenmin' }, function(data) { alert(data) });
jquery.get("newdoajax.aspx", { max: ' b !', name: 'wsenmin' }, function(data) { alert(data) });
var superman = "max=i am jq &name= it is ajax ";
jquery.ajax({
type: "post",
url: "newdoajax.aspx",
data: superman,
success: function(msg) {alert(msg);}
});
<%@ page language="c#" validaterequest="false" enablesessionstate="true"%>
<%@ import namespace="system.data.sqlclient" %>
<%@ import namespace="system.data" %>
<%@ import namespace="system.configuration"%>
<%@ import namespace="system.web.security"%>
<%@ import namespace="system.drawing"%>
$.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);}
});
asp.aspx页面代码
response.contenttype = "application/网页特效on";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");
jquery.post( url, [da
参数:
url (string) : 发送请求的url地址.
da
callback (function) : (可选) 载入成功时回调函数(只有当response的返回状态是success才是调用该方法)。
type (string) : (可选)官方的说明是:type of da
这是一个简单的 post 请求功能以取代复杂 $.ajax 。请求成功时可调用回调函数。如果需要在出错时执行函数
相关文章
- 详谈jQuery Ajax(load,post,get,ajax)的用法 05-15
- HTML简单购物数量小程序代码展示 10-31
- html canvas实现弹幕功能 10-31
- HTML中空格表示的意义 10-31
- html area标签解读 10-31
- html使用表单标签实现注册页面代码展示 10-31