Code block for router is like below:
router
.get('/', function* (next) {
this.body = dot.main(some_data);
})
.post('/some_operation', function* (next) {
//code for sending data to DB
//this.body = dot.main(some_data);
});
I need to send some data to DB with post request while staying on the same page (not reloading the page). If I use "this.body ..." line, page gets reloaded. Not using it gives "Not found" displayed (which is logical). How can I do something like AJAX in order to send data to DB asynchronously not reloading the page?