JSON Parse error:Unrecognized token xxx
发布日期:2021-05-06 23:22:37 浏览次数:20 分类:技术文章

本文共 729 字,大约阅读时间需要 2 分钟。

原文

fetch("http:/example.com", {method: "POST",  body: JSON.stringify(    {      uname: uname,      password: password          }  )}).then((response) => response.json()).then((responseData) => {  AlertIOS.alert(      "POST Response",      "Response Body -> " + JSON.stringify(responseData.body)  )}).done();       this.props.navigation.navigate("Home")   };

 

 

修改后的  response.text()代替response.json()

fetch("http:/example.com", {method: "POST",  body: JSON.stringify(    {      uname: uname,      password: password          }  )}).then((response) => response.text()).then((responseData) => {  AlertIOS.alert(      "POST Response",      "Response Body -> " + responseData  )}).done();       this.props.navigation.navigate("Home")   };

 

上一篇:windows 安装Eclipse win7为例
下一篇:linux 网络工具包net-tools 和iproute命令对比,

发表评论

最新留言

初次前来,多多关照!
[***.217.46.12]2025年03月30日 16时20分53秒