$.ajax({
url:"",
type:"POST",
data:{},
dataType : "json",
success : function(data, textStatus, xhr) {
alert("更新成功");
window.location.href=document.referrer;
},
error : function(data, textStatus, xhr) {
alert("更新失败");
}
});
url:"",
type:"POST",
data:{},
dataType : "json",
success : function(data, textStatus, xhr) {
alert("更新成功");
window.location.href=document.referrer;
},
error : function(data, textStatus, xhr) {
alert("更新失败");
}
});
本文介绍了一种使用Ajax技术进行数据更新的方法。通过一个简单的示例代码,展示了如何设置Ajax请求的URL、类型、数据格式及响应处理等关键步骤。当操作成功时会提示用户并跳转回前一页,若失败则显示错误信息。
673

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



