选项卡无法正常工作

tab its not working correctly

我正在尝试使用 Express 在我的 Node.js 中放置一个选项卡面板,但是当我单击选项卡时无法更改文本,例如常规。

我没有任何错误。

我不知道为什么它不起作用。我正在将 PHP 网站转换为 Node.js Jade and Express。

这是我的代码:

玉档:

   block content
  h1 Last News
  section#page-title
      h1.mainTitle 
      br
      .tabbable
        ul#myTab2.nav.nav-tabs.nav-justified
          li.active
            a(href='#All', data-toggle='tab')
              | All
          li
            a(href='#Geral', data-toggle='tab')
              | General
          li
            a(href='#Events', data-toggle='tab')
              | Events
          li
            a(href='#Updates', data-toggle='tab')
              | Updates
          li
            a(href='#Sales', data-toggle='tab')
              | Sales
          li
            a(href='#Community', data-toggle='tab')
              | Community
        .tab-content
          #All.tab-pane.fade.in.active
            p
              | Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth.
            p
              | Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.
          #Geral.tab-pane.fade
            p
              | Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet. Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo.
            p
              | Raw denim you probably haven't heard of them jean shorts Austin. Nesciunt tofu stumptown aliqua, retro synth master cleanse. Mustache cliche tempor, williamsburg carles vegan helvetica. Reprehenderit butcher retro keffiyeh dreamcatcher synth.
          #Events.tab-pane.fade
            p
              | Trust fund seitan letterpress, keytar raw denim keffiyeh etsy art party before they sold out master cleanse gluten-free squid scenester freegan cosby sweater. Fanny pack portland seitan DIY, art party locavore wolf cliche high life echo park Austin.
            p
              | Cosby sweater eu banh mi, qui irure terry richardson ex squid. Aliquip placeat salvia cillum iphone. Seitan aliquip quis cardigan american apparel, butcher voluptate nisi qui.

和我的 New.js:

var express = require('express');
var router = express.Router();

/* GET users listing. */
router.get('/', function(req, res, next) {
  res.render('news', { title: ' Last news' });
  $(document).ready(function(){
    $(".nav-tabs a").click(function(){
        $(this).tab('show');
    });
});
});

module.exports = router;

我做错了什么?

Node.js 是服务器端,您无法从 Express 更新浏览器内的网页内容。使用 Express,您只能响应数据请求。您将需要在您的 Express 应用程序中构建一个 API 路由,以便从您的数据存储中检索数据,并在收到请求时通过 AJAX 调用从您的 UI 代码中获取数据。