$("div:last").ajaxComplete(function(evt, request, settings){
$.each(evt,function(property,value){$("div:last").append("<p>evt: "+property + ":" + value + "</p>");});
$("div:last").append("<p>request: "+ typeof request + "</p>");
$.each(settings,function(property,value){$("div:last").append("<p>settings: "+property + ":" + value + "</p>");});
});
$.ajaxSetup({
url: "handler",
success: function(data){
$("div:first").html(decodeURI(data));
}
});
function getQueryString(){
var name=encodeURI(encodeURI($(":text").val()));
var pass=encodeURI(encodeURI($(":password").val()));
return "name="+name+"&pass="+pass;
}
$(":submit").click(function(){
$.ajax({
data: getQueryString(),
type: "post"
});
return false;
})
jQuery ajax - ajaxComplete() 方法
最新推荐文章于 2024-06-22 15:15:39 发布
本文介绍了一种利用jQuery库简化Ajax操作的方法,通过具体的代码示例展示了如何在用户提交表单时发起Ajax请求,同时处理请求成功后的响应数据。
1472

被折叠的 条评论
为什么被折叠?



