【发布时间】:2020-07-12 17:52:46
【问题描述】:
js 和 javascript...我在如何将数组值从客户端 .js 文件发送到服务器端 app.js 到发布请求中遇到问题。
var = testParamterName=[],testParameterValue=[];
$("#Table1 tbody tr").each(function(rowinex){
// this basically gets the 2 column values that i require
var i=0;
$.each(this.cells,function(callIndex,cell){
if(i==2) //parameter value
{
testParamterName.push(cell.textContent);
} else if(i==3)
{
testParameterValue.push(cell.textContent);
}
i++;
});
i=0;
});
我正在使用 jQuery 在名为 test.js 的文件中从表中获取值 将表值保存到两个数组后,即“testParameterValue”和“testParamterName”
现在我想将这 2 个数组值发送到我的服务器端 .js 文件 app.js
我使用了 module.exports = {testParameterValue , testParametername}; 但这给出了一个错误,说模块未定义..
我尝试在网上搜索找不到我的问题的解决方案......我找到的最接近的解决方案是......无法将 module.exports 运行到在浏览器中运行的文件中。
我跳过了处理提交点击事件的代码
请帮帮我...在此先感谢 :)
【问题讨论】:
标签: javascript jquery arrays express post