First I will create a new row in a HTML dynamic table. I have used JavaScript to create and remove rows from the table. Once the row is inserted and I would like to search by ID that the user request and then load some data accordingly. For example the name and price. And then he will be able to quantify and/or add more rows(items). At the end saving as an order.
router.get:
router.get('/searching', function(req,res){
var sql = req.query.sku;
//call MySQL Query. and //extract key using req.query.key
db.query('SELECT * FROM item_new WHERE sku= '+sql,
function(err, rows, fields) {
if (err) throw err;
console.log(rows);
res.json(rows[0]);
});
});
HTML page
<form id="filterForm" action="/user/searching" method="GET">
<input id="filter" class="typeahead tt-query" spellcheck="false" autocomplete="off" name="sku" type="text" placeholder="type Sku">
<input type="submit">
</form>
but I want to display the results on the index page and I don't want to go to a new page when a submit.