Javascript 将值从HTML表单提交到节点js
我想将HTML表单中的输入值提交给节点js。Node js应该将该值作为参数分配给Solidity函数。但是错误:Javascript 将值从HTML表单提交到节点js,javascript,html,node.js,solidity,Javascript,Html,Node.js,Solidity,我想将HTML表单中的输入值提交给节点js。Node js应该将该值作为参数分配给Solidity函数。但是错误:TypeError:无法读取未定义的的属性“oinput”。我该怎么办?请帮助初学者 HTML: 坚固性: pragma solidity ^0.5.12; contract Yerevan{ string public city; function eval(string memory sense) public returns(string me
TypeError:无法读取未定义的
的属性“oinput”。我该怎么办?请帮助初学者
HTML:
坚固性:
pragma solidity ^0.5.12;
contract Yerevan{
string public city;
function eval(string memory sense) public returns(string memory){
city=sense;
return city;
}
}
您已将body parser包含在文件中,但尚未要求应用程序使用它。 在下面一行添加
const bodyParser = require("body-parser");
// for parsing application/json
app.use(bodyParser.json());
//for parsing application/xwww-form-urlencoded
app.use(bodyParser.urlencoded({ extended: true }));
如果您正在使用var,请开始使用const,然后改为let
pragma solidity ^0.5.12;
contract Yerevan{
string public city;
function eval(string memory sense) public returns(string memory){
city=sense;
return city;
}
}
const bodyParser = require("body-parser");
// for parsing application/json
app.use(bodyParser.json());
//for parsing application/xwww-form-urlencoded
app.use(bodyParser.urlencoded({ extended: true }));