$.post("${pageContext.request.contextPath}/user/add",addEquipmentJson,
function(data){
}, "json")error(function(){
$.messager.alert('提示',"网络错误");
});
$.get(window.GLOBAL.domainRest, function (data) {
}).error(function(xhr,errorText,errorType){
});;
$.ajax({
url: "${pageContext.request.contextPath}/scheduledCheck/checkScheduledRecordexportPermission?random="+Math.random(),
data : {equipmentCode: equipmentCode},
dataType: "json",
success: function(data){
$.messager.alert('提示',data.message);
if(data.states != 200){
repairStaff
}
},
type:"POST",
error: function(req, status, err){
$.messager.alert('提示',"请求错误");
}
});
ajax并不能区分是否是404还是302,因为页面不会告诉xhr对象,所以除了200到300之间的状态码,其他的都会返回到error内容中。其中status 为success或者failure
如果非要说解决方案,可以通过服务器判断ajax请求进行处理,参见:https://www.iteye.com/blog/mzhou-2078268