0

路由器的代码块如下:

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

我需要在保持在同一页面上(不重新加载页面)的同时通过发布请求向数据库发送一些数据。如果我使用“this.body ...”行,页面会重新加载。不使用它会显示“未找到”(这是合乎逻辑的)。如何执行 AJAX 之类的操作,以便将数据异步发送到 DB 而不是重新加载页面?

4

0 回答 0