网上看到老外写的
1 // jQuery plugin to prevent double submission of forms 2 jQuery.fn.preventDoubleSubmission = function() { 3 $(this).on('submit', function(e) { 4 var $form = $(this); 5 6 if ($form.data('submitted') === true) { 7 // Previously submitted - don't submit again 8 e.preventDefault(); 9 } else { 10 // Mark it so that the next submit can be ignored 11 $form.data('submitted', true); 12 } 13 }); 14 15 // Keep chainability 16 return this; 17 }; 18 19 20 //Use it like this 21 $('form').preventDoubleSubmission();
转载于:https://www.cnblogs.com/qzsonline/p/3178247.html
相关资源:JAVA上百实例源码以及开源项目