javascript - 将值传递给 Firestore 数据库
问题描述
数据没有被推送到我的 Firestore,我不知道为什么以及我做错了什么创建了 Web 应用程序 ,然后是文档。我卡住感觉脑死了
我的文档中的脚本
// Write data to firestore
<script src="https://www.gstatic.com/firebasejs/9.0.1/firebase-app.js"></script>
<script src="https://www.gstatic.com/firebasejs/9.0.1/firebase-firestore.js"></script>
<script>
const firebase = require("firebase");
// Required for side-effects
require("firebase/firestore");
// Initialize Cloud Firestore through Firebase
firebase.initializeApp({
apiKey: 'mykey',
authDomain: 'myauthdomain',
projectId: 'myprojectid'
});
var db = firebase.firestore();
db.collection("felanmalan").add({
namn: "firstname surname",
epost: "mail@gmail.com",
tel: "myphonenumber",
fast: "where i live",
meddelanse: "whats wrong with appartment"
})
.then((docRef) => {
console.log("Document written with ID: ", docRef.id);
})
</script>
当我按下回车键时,我在想数据会被传递到我的 Firestore,但什么都没有。我以为这很容易,但事实并非如此。我之前通过 php 到 mysql 完成了一些 html 表单,但这似乎超出了我的想象。有人可以解释我如何在极其基础的水平上完成这项工作。
我的最终目标是拥有一个将数据发送到 Firestore 的 html 表单,然后使用 Zapier 函数将最后的数据发送出去。不会为此设置另一个 smtpserver 大声笑!
解决方案
推荐阅读
- php - WooCommerce:更改相关产品标题并删除/更改
- android - 使用底部导航和导航组件在选项卡之间传递数据
- python-3.x - APScheduler 不会从 Tkinter 开始
- block - 从块文件中的 url 获取 id
- r - 在R中的多个数据帧的函数中结合for循环和变异
- php - PHP:缩进文件,块由 { 和 } 分隔
- kubernetes - 如何使用 Kubernetes 自定义资源作为部署配置?
- r - R:基于字符串替换列值的有效方法(可能使用 case_when 或其他形式的变异)?
- sdk - 如何将包从构建机器移动到 SDK/交叉编译器工具链
- c# - 检测用户在 Internet Explorer 加载项 dll 上的下载