【发布时间】:2017-07-07 19:21:40
【问题描述】:
我可以快速点击照片菜单 4 次,“$.get(...” 被发送到服务器 4 次。 我需要禁用此菜单(单击一次后),以便无法再次单击它。 环境:NodeJS、Express、Pug、Jquery 谢谢, 帕特
--------------DOM----------------------------------
// file = photos.pug
div#wrapper2
div#altnav
ul
include includes/altnav.pug
include includes/navjs.pug
---------------------------------------------------
// file = includes/altnav.pug
li: a.navigation(href='#', data-level='/images/cs/Photos') Photos
---------------------------------------------------
// file = includes/navjs.pug
script.
$(function(){ // jQuery DOM ready
$('.navigation').click(function () {
var level = 'm' + $(this).data('level'); // Append an 'm' so I know this came from navjs.pug
var url = '/navigation?level=' + escape(level); // Send this to the /router/photos.js
$.get(url, function (data) {
$('body').html(data); // data = new HTML page to be loaded by browser
});
});
});
【问题讨论】:
标签: jquery html node.js express