为什么ajax调用不了回调函数呢,既不走success,也不走fail函数???
先上源代码:
$.ajax({
type:"post",
dataType: "json",
contentType:"application/x-www-form-urlencoded",
url : '${rc.contextPath}/registController/studentRegist',
data:form,
// async:false,
success:function (data) {
debugger;
if(data.code == “success”){
console.log(data);
window.location.href="KaTeX parse error: Expected 'EOF', got '}' at position 48: … }̲else{ …{rc.contextPath}/to500";
}
},
error:function () {
debugger;
alert(“系统发生错误,请联系管理员!”)
}
});
不管怎么改就是不进回调函数,但是debug可以进去
解决方案:
2. 在创作中心设置你喜爱的代码高亮样式,Markdown 将代码片显示选择的高亮样式 进行展示;
error:function () {
debugger;
alert(“系统发生错误,请联系管理员!”)
}
});
return false;
})
}); //在后面加个 return false
原因:
这是因为你前端使用了layui,layui使用不当,可能导致,ajax调用不了回调函数