我如何导出在.js文件中声明的对象到我的index.js



在我的.ejs文件中有一个脚本,该脚本非常简单,我只是从用户那里抓取输入数据并放入对象中。所以,我想做的是将这个对象发送到我的index。js在我的index。js中,我将使用来自对象的数据在一个名为coap的节点模块中使用(非常类似于http),但我真的不知道如何将我的对象从。js文件发送到我的index。js文件,我使用express模块。

const btnSubmitData = document.getElementById("btnSubmitData")
btnSubmitData.addEventListener("click", () => {
const boardIP = document.getElementById("BoardInputIP").value
const boardMethod = document.querySelector('input[name="inlineRadioOptions"]:checked').value
const boardFunction = document.getElementById("selectFunction").value
const boardPoint = document.getElementById("selectPoint").value
const inputDataBoard = {
ipBoard: boardIP,
methodCoapBoard: boardMethod,
functionBoard: boardFunction, 
pointBoard: boardPoint
}

})

你不需要使用ejs来显示-而不是index.js吗?

最新更新