【发布时间】:2016-04-05 06:14:40
【问题描述】:
我想通过 fetch API 向服务器发送一些数据,以便它可以基于该数据查询数据库。与 Ajax 不同,我找不到任何合适的方法来做到这一点。 这是我的 fetch 调用:
{fetch("http://192.168.90.53:4000/game/?email=adicool2294@gmail.com", {method: "GET"} )
.then((response) => response.json())
.then((responseData) => {
id= responseData.id;
name= responseData.name;
console.log(responseData);
})
.catch((error) => {
console.warn(error);
});
}
}
我想发送一个参数,例如电子邮件,以便服务器可以使用它来查询数据库。我正在使用 react-native android,因此不能使用 Ajax 请求。 我只想使用 GET 方法。目前,我在 URL 中传递的查询参数未在 req.query 中由服务器显示
【问题讨论】:
标签: react-native fetch fetch-api