报错如下:
Access to XMLHttpRequest at 'http://131.43.15.14:8800/' from origin 'http://127.0.0.1:8080' has been blocked by CORS policy: Request header field content-type is not allowed by Access-Control-Allow-Headers in preflight response.
下面代码是不是没有做跨域?
var jsonString = JSON.stringify(jsonObject);
93 // 创建 XMLHttpRequest 对象
94 //var xhr = new XMLHttpRequest();
95 //var url = "your_backend_url_here"; // 替换成你的后端接口地址
96 // 设置 POST 请求
97 // xhr.open("POST", url, true);
98 xhr.setRequestHeader("Content-Type", "application/json");
99 // 发送请求
100 xhr.send(jsonString);