小编Nna*_*ugo的帖子

如何使PJAX与Express和EJS一起使用?

好的,从noob那里提问。但是我一直在尝试使pjax工作一段时间,而且似乎没有任何效果。我得到的最好的成绩是对终端中的流程的认可,但是当我单击链接时,它会将我带到整个其他页面,而不是在指定的div中显示其内容。

我还提供了Chris Wanstrath的pjax源代码的链接。似乎没有任何作用。

//The schedule.js file 
router.get('/', function(req, res) {
  res.render('schedule', { title: 'Schedule' });
});

//The jQuery end of the line
$(document).pjax('a[data-pjax]', '#pjax-container');
Run Code Online (Sandbox Code Playgroud)
 <li><a data-pjax="#pjax-container" href="/schedule">Schedule</a></li>
 
 <div id="pjax-container"> 
 </div>
Run Code Online (Sandbox Code Playgroud)

javascript express pjax

3
推荐指数
1
解决办法
293
查看次数

标签 统计

express ×1

javascript ×1

pjax ×1