ajax errorthrown属性,【技术】error:function (XMLHttpRequest, textStatus, errorThrown)

完整代码:

var data = {

name: name,

sex: sex,

cardno: cardno,

birth: birth,

email: email,

grade: grade,

school: school,

homephone: homephone,

parentmobile: parentmobile,

parentemail: parentemail,

address: address,

zhusu: zhusu,

shenqingjiudu: shenqingjiudu,

jianhuren: jianhuren,

cmd: ‘baoming‘

};

$.ajax({

type: ‘POST‘,

data: data,

dataType: ‘json‘,

url: ‘ajax.php‘,

error: function(XMLHttpRequest, textStatus, errorThrown) {},

success: function(msg) {

// msg.no == 1 :这个是根据后端定义的值no=1的时候,是操作成功。

if (msg.no == 1) {

alert(msg.msg);

//如果符合条件,则清空#apply input的内容

$("#apply input").val("");

return;

} else {

alert(msg.msg);

return false;

}

}

});

error:function (XMLHttpRequest, textStatus, errorThrown){} 释义:

这是一个 Ajax 事件。

(默认: 自动判断 (xml 或 html)) 请求失败时调用时间。

参数有以下三个:XMLHttpRequest 对象、错误信息、(可选)捕获的错误对象。

如果发生了错误,错误信息(第二个参数)除了得到null之外,还可能是"timeout", "error", "notmodified" 和 "parsererror"。

textStatus:

"timeout", "error", "notmodified" 和 "parsererror"。

原文:http://www.cnblogs.com/ybingbing_1213/p/3968638.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值