// 方法1设置响应体数据的类型 json数据格式自动转换**
xhr.responseType='json';
console.log(xhr.response);
方法2手动转换
JSON.parse(xhr.response)
<!--此时的xhr 返回的response为json对象的形式-->
如何是后台相应response返回json对象形式
最新推荐文章于 2024-06-03 19:11:13 发布
// 方法1设置响应体数据的类型 json数据格式自动转换**
xhr.responseType='json';
console.log(xhr.response);
方法2手动转换
JSON.parse(xhr.response)
<!--此时的xhr 返回的response为json对象的形式-->