贴吧发帖防止多次提交表单

This commit is contained in:
cxt 2016-05-13 14:52:38 +08:00
parent 89749b853b
commit 22523d25b8
1 changed files with 3 additions and 1 deletions

View File

@ -109,11 +109,13 @@
<% end %> <% end %>
}); });
var first_click = true;
function check_and_submit(){ function check_and_submit(){
if(!check_memo_name()){ if(!check_memo_name()){
return; return;
} }
if($("textarea[name='memo[subject]']").val().trim() != "" && !memo_content.isEmpty() ){ if($("textarea[name='memo[subject]']").val().trim() != "" && !memo_content.isEmpty() && first_click){
first_click = false;
memo_content.sync(); memo_content.sync();
$.ajax({ $.ajax({
url:'/forums/'+'<%= @forum.id.to_s%>'+'/memos', url:'/forums/'+'<%= @forum.id.to_s%>'+'/memos',