The $http.jsonp request of angularjs reports an error, the code is as follows:
data = {
a:A,
b:B,
c:C,
}
$http.jsonp('url',data).success(function(res){
console.log(res);
}).error(function(err){
console.log(err);//控制台打印fasle
})
并报错:Uncaught SyntaxError: Invalid or Unexpected token url(请求链接)
Click this link, get the data, verify it in json online verification, and find that there is a line break in the B field, but you can't find any line break when you access it in the browser using the link. I contacted the backend, and the backend said that there were no line breaks when entering the database, and my front end couldn’t get the data and couldn’t process it. What else could be the reason for this situation, and how should I solve it?
Thank you for the invitation. I didn’t see the address. There should be something wrong with the returned data format.
You can open https://www.w3schools.com/js/... in the browser, then use the developer tools to view the Network panel to view the HTTP information.
Example of using XMLHttpRequest object to request data