修复创建贴吧时,提示“贴吧名称已经存在”,实际又新建成功了 的问题 app/views/forums/index.html.erb

liuyizhou
liuyizhou 9 years ago committed by louant
parent 0a82de1cf4
commit 0ed26310e3

@ -28,6 +28,7 @@
}
}
$(function() {
hideError();
$("#complex").click(function(){
$("#reorder_popu").removeClass("sortArrowActiveU");
$("#reorder_popu").removeClass("sortArrowActiveD");
@ -71,10 +72,11 @@
e.preventDefault();
}
})
});
function check_and_submit(doc){
$("#error").html('').hide();
check_forum_name();
$("#error").html("").hide();
// check_forum_name();
if( $("textarea[name='forum[name]']").val().trim() == "" && $("textarea[name='forum[description]']").val().trim() != "" ){
$("#error").html("名称不能为空").show();
return;
@ -91,17 +93,20 @@
}
var check_pass = true;
function check_forum_name(){
$("#error").html("").hide();
check_pass = true;
name = $("textarea[name='forum[name]']").val().trim();
alert(name)
if( name != ""){
$.get(
'<%= check_forum_name_forums_path %>',
{"forum_name":encodeURIComponent(name)},
function(data){
alert(data)
if( data == 'true'){
$("#error").html("贴吧名称已经存在").show();
check_pass = false;
return false;
}
}
);

Loading…
Cancel
Save