Daniel Kim
Daniel Kim

Reputation: 446

how to pass data object from jade to node.js

I'm trying to build a data object in jade view page to my server side JS. it has dynamic html creation that inserts input boxes as user wants

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++;
        }

and also have couple more fields in body

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

It seems like I can't retrieve 'order' object from my server side app.js. How can I pass dynamically built data object to server side?

Upvotes: 0

Views: 798

Answers (1)

Kit Ho
Kit Ho

Reputation: 26968

You should use POST or GET method or Ajax(client side javascript) to send data to the nodejs server side

In Jade, it is only act as view in MVC model, you can't pass data from jade to nodejs.

Upvotes: 1

Related Questions