Express.js:获取同一个源iframe的req.body.datas

时间:2018-05-03 12:34:36

标签: javascript express iframe server sequelize.js

因为嵌套表单是一种不好的做法,我从我的网站源代码中创建了一个加载另一个表单的内部iframe。因为它的内部我已经添加了样式和所有内容,但是当发布低谷时(我也使用sequelize来创建我的实体),即使加载了返回页面,我的数据也是空的。是我想念的东西吗?也许我必须指定req.accepts(),我问是否有人知道这类问题。

app.post('/sendOwners', function (req, res) {
  ownerController
//these are empty even filled from the front end
     .create(req, res, req.body.name,req.body.firstname, req.body.civility) 
     .then(function(owner){
        res.send('contenu owner' +owner +'contenu req:'+req.body)
     })
})

我的iframe

  <iframe id="iframeID"
          name="_parent"
          sandbox="allow-forms allow-same-origin"
          src="owners"
   ></iframe>

1 个答案:

答案 0 :(得分:0)

我没有在网上找到关于这个主题的明确答复。我必须找到一种方法,几个小时后我终于将方法形式更改为'get'并使用req.query来访问我的数据。它似乎现在有效。