The textStatus error in ajax is parsererror.
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<body>
<script src="js/jquery-1.8.0.min.js" type="text/javascript" charset="utf-8"></script>
<script src="js/jq.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
$.ajax({
type: "GET",
url: "http://192.168.20.205:8080/platform/banner/bannerApi",
async:true,
dataType: "jsonp",
jsonp: "callback",
success:function(req){
console.log(req);
},
error:function(XMLHttpRequest, textStatus, errorThrown) {
alert(XMLHttpRequest.status);//400
alert(XMLHttpRequest.readyState);//2
alert(textStatus);//parsererror
}
});
</script>
</body>
</html>
Please give me some advice. I have never encountered this problem before. You can also find other methods. Just wait.
This probably needs to be combined with the background and specify a parameter named
jsonpCallback
.Is the returned thing in jsonp format?
Tips, this is a cross-domain issue. If you wrote the backend, you can configure Cors. The code is as follows. I hope it can help you. By the way, spring needs to be scanned
The dataType returned by the background is inconsistent with the dataType requested by ajax