1
嘿,我使用的是一個jQuery插件,當我專注於一個領域,並專注於它警告我的驗證錯誤。jQuery的驗證腳本不重置時,另一個Ajax調用
現在在我的設置我有一個加載通過AJAX從另一個網頁的內容,並與該內容我還有一個子菜單,在與另一個Ajax請求還要求內容的菜單。
方案
我的文件單擊,從主菜單,然後點擊查看從子菜單,然後從那裏創建(使用另一個Ajax請求)的創建內容
是我現在用的是驗證插件,就像我說的,當我關注它的工作,但如果我再次從主菜單上點擊文件驗證錯誤仍然在彈出的地方。如果我點擊從子菜單中的查看,然後驗證錯誤淡出。
我試圖隔離問題,爲什麼錯誤會從子菜單調用ajax調用而淡出,但現在使用主菜單。
主菜單腳本:
//------------------------------------------------------------------
// Pidget menu
//------------------------------------------------------------------
var content = '#main-content',
wrap = '#wrap';
$("nav a.files-menu-link").live('click', function({
$.validationEngine.closePrompt('.formError',true);
$(content).hide(200, function(){
$(wrap).load('files.php' + content, function(){
$(this).hide().html(data).slideDown(500);
});
})
return false;
});
子菜單腳本
$('a#prospect-file-link').live('click', function(){
$.validationEngine.closePrompt('.formError',true);
$.post('resources/ajax/ajax.php', {
action : 'prospects',
uid : uid
}, function(data){
$('#files-right-pane').hide().html(data).slideDown(500);
$(".alpha").click(function() {
$(this).find("span").toggleClass("expand-alpha-down");
$(this).next(".show").slideToggle();
return false;
});
});
return false;
});
然後創建新的腳本
//-- Create new prospect
$('a.new-prospect').live('click', function(){
$('#files-right-pane').fadeOut(200);
$.post('resources/ajax/ajax.php', {
action : 'create_prospect',
uid : uid
}, function(data){
$('#files-right-pane').hide().html(data).slideDown(500);
selectBox('prospect-type', 'prospect-type-td');
selectBox('status', 'status-td');
selectBox('primary-number', 'primary-td');
selectBox('secondary-number', 'secondary-td');
mce('new-prospect-comments');
$("#new-prospect-form").validationEngine();
$('.state').autoSuggest('resources/ajax/suggest.php', {minChars: 2, matchCase: false, startText: '', asHtmlID: 'state'});
});
return false;
});
HTML標記
...
<td><input type="text" id="first_name" name="first_name" class="validate[required]" /></td>
<td><input type="text" id="middle_name" name="middle_name" /></td>
<td><input type="text" id="last_name" name="last_name" class="validate[required]" /></td>
...
這就是我的設置,我無法弄清.closePromp()在視圖中的作品,但不是與主菜單鏈接
嗯,我似乎已經定格在我的代碼。在修復它之前我必須複製並粘貼一個版本。仍然存在問題持續存在。 – Eli