“JSON 解析错误:无法识别的令牌’<‘”点击 api 时显示错误。代码附在下面注*:响应为 JSON 格式。
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")
};
请帮忙。谢谢,
原文由 Ananta Prasad 发布,翻译遵循 CC BY-SA 4.0 许可协议
最后下面的代码工作了。问题在于身体参数。