【问题标题】:how to pass data object from jade to node.js如何将数据对象从玉传递到 node.js
【发布时间】:2011-11-20 12:59:42
【问题描述】:

我正在尝试在我的服务器端 JS 的玉视图页面中构建一个数据对象。 它具有动态 html 创建功能,可根据用户需要插入输入框

function addDetail() {
            var detailHtml = 
                '<tr><td width="55%"><input style="width:98%;" type="text" name="order.detail['+currentDetailCount+'].nam" /></td>' +
                '<td width="1%"><input type="checkbox" name="order.detail['+currentDetailCount+'].prc" /></td>' +
                '<td width="1%"><input type="checkbox" name="order.detail['+currentDetailCount+'].beg" /></td>' +
                '<td width="1%"><input type="checkbox" name="order.detail['+currentDetailCount+'].cut" /></td>' +
                '<td width="1%"><input type="checkbox" name="order.detail['+currentDetailCount+'].asb" /></td>' +
                '<td width="49%"><input  style="width:98%;"type="text" name="order.detail['+currentDetailCount+'].msc" /></td></tr>';
            $('tbody#detailAddTbody').append(detailHtml);
            currentDetailCount++;
        }

并且在正文中还有更多字段

select(name='order.cname',id='cname')
input(type='text', name='order.ordindate', id='ordindate')

似乎我无法从服务器端 app.js 中检索“订单”对象。 如何将动态构建的数据对象传递到服务器端?

【问题讨论】:

    标签: javascript node.js express pug


    【解决方案1】:

    您应该使用 POST 或 GET 方法或 Ajax(客户端 javascript)将数据发送到 nodejs 服务器端

    在 Jade 中,它只是作为 MVC 模型中的视图,不能将数据从玉传递到 nodejs。

    【讨论】:

      猜你喜欢
      • 2016-11-15
      • 2016-03-14
      • 1970-01-01
      • 2014-11-03
      • 2012-10-09
      • 1970-01-01
      • 1970-01-01
      • 2018-01-13
      • 2016-06-04
      相关资源
      最近更新 更多