0
問題與字段驗證和兩個jQueryUI對話框。jQuery對話框不會停止重新開放
第一個jQUI對話框中有一個註冊表單。
使用AJAX對用戶名字段進行字段驗證。如果字段驗證失敗(已存在),則PHP文件返回一個大於零的數字,並在第二個jQueryUI對話框中顯示錯誤消息。
但是,當用戶關閉第二個對話框時,它會立即重新打開,永遠。
有什麼想法?
$("#c_username").blur(function() {
var uu = ($(this).val()).toLowerCase();
$(this).val(uu); //in case user did not input as all lowercase
$.ajax({
type:'POST',
url: 'ajax/ax_all_ajax_fns.php',
data:'request=does_username_already_exist&username=' + uu,
success: function(data) {
if (data != 0) {
$('#alert').html('Username <span style="font-weight:bold;color:darkgreen;">' +uu+ '</span> already exists. Please enter another.');
$('#alert').dialog({
title: 'Username already exists:',
width: 400,
close: function() {
$(this).dialog('destroy');
}
});
$("#c_username").addClass('field_invalid').focus();
}else{
alert("Username is okay");
}
}
});
});
非常感謝.... – gibberish