-1

这是我的帖子:

account_id  1231
limit   3
ordertype   limit
quantity    1
symbol  USDJPY
transaction_type    buy

在我的代码中,我有:

 var account_id = req.param('account_id', null);
  var symbol_pair = req.param('symbol', null);
  var transaction_type = req.param('transaction_type', null);
  var order_type = req.param('ordertype', null);
  var amount = req.param('amount', null);
  var limit = req.param('limit', null);

console.log(account_id + " | " + symbol_pair + " | " + transaction_type + " | " + order_type + " | " + amount + " | " + limit);return;

但不知为何ordertype又回来了market。有什么想法吗?

4

2 回答 2

3

确保您拥有app.use(express.bodyParser());并尝试使用req.body.account_id(每种风格都相似)

http://expressjs.com/guide.html#http-methods

于 2012-05-07T11:04:10.457 回答
0

您正在定义 order_type,然后尝试使用 ordertype 将其取回。不要忘记你的:下划线!

于 2012-05-06T23:23:51.763 回答