Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/node.js/42.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Node.js 它不能正常工作_Node.js_Jade4j - Fatal编程技术网

Node.js 它不能正常工作

Node.js 它不能正常工作,node.js,jade4j,Node.js,Jade4j,我正在尝试使用Express在Node.js中放置一个选项卡面板,但在单击选项卡(例如general)时无法更改文本 我没有任何错误 我不知道为什么它不起作用。我正在将PHP网站转换为Node.js Jade和Express 这是我的代码: 翡翠档案: block content h1 Last News section#page-title h1.mainTitle br .tabbable ul#myTab2.nav.nav

我正在尝试使用Express在Node.js中放置一个选项卡面板,但在单击选项卡(例如general)时无法更改文本

我没有任何错误

我不知道为什么它不起作用。我正在将PHP网站转换为Node.js Jade和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.
还有我的新.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调用接收到请求时检索数据