考虑:
InsertDataToServer = () => {
const { pinValue1 } = this.state;
const { pinValue2 } = this.state;
const { pinValue3 } = this.state;
const { pinValue4 } = this.state;
var String_3 = pinValue1.concat(" ", pinValue2);
var String_4 = String_3.concat(" " , pinValue3);
var String_5 = String_4.concat(" " , pinValue4);
fetch("http://www.aonde.biz/mobile/doLogin.php", {
method: "POST",
headers: {
Accept: "application/json",
"Content-Type": "application/json"
},
body: JSON.stringify({
"pin": 212,
})
})
.then(response => response.json())
.then(responseJson => {
// Showing the response message coming from
// the server after inserting records.
Alert.alert(responseJson);
})
.catch(error => {
console.error(error);
});
在上面的代码中,当我传递“pin”参数 API 时,它显示了这个错误:
我该如何解决这个问题?
原文由 Atul Tiwari 发布,翻译遵循 CC BY-SA 4.0 许可协议
您可以简单地从
pin
中删除双引号。