function checkname(o) {
var o = $('#log').val();
$.ajax({
url: 'check_name',
type: 'POST',
data: 'username=' + o,
success: function(o){
if(o == 1) {
return o;
}
else {
o.addClass( "ui-state-error" );
updateTips( "not available" );
return false;
}
}
});
}
与模型中的表格相关的此功能是否可用
$( "#dialog-form" ).dialog({
autoOpen: false,
height: 600,
width: 550,
modal: true,
buttons: {
"save": function() {
var bValid = true;
allFields.removeClass( "ui-state-error" );
bValid = bValid && checkname ( name, "name");
if ( bValid ) {
$.ajax({
type: 'POST',
url: 'add_user',
data: $('#myform :input').serialize(),
success: function(i) {
alert('sucess');
window.setTimeout(function(){location.reload()},500)
}
});
$( this ).dialog( "close" );
}
},
Cancel: function() {
$( this ).dialog( "close" );
}
},
close: function() {
allFields.val( "" ).removeClass( "ui-state-error" );
}
});
当我单击保存表单时不会保存或仅在萤火虫中不会关闭返回 1
我想如果名称可用表格保存