我使用jQuery.form插件.ajaxSubmit()
之間div的彈出和視圖(用於日誌記錄和有時驗證目的)。用戶可以前後導航。一些div有完整的表單數據,在這種情況下,我會使用表單的父div作爲target:
。但是,其他div包含文本和導航按鈕,並且它們不需要更新(在ajaxSubmit返回指示要彈出的下一個div ID的字符串之後,只需.hide()
)。如果我使用$(this).parent('div')
作爲目標,整個div將被返回的字符串覆蓋。該字符串僅用於填充隱藏元素以幫助瀏覽這些屏幕/ div。jquery.form更新目標的一些時間
$('.CSRForm').submit(function() {
$(this).ajaxSubmit({
target: $(this).parent('div'), //for validation purposes on the forms with data
success: StepCall //to check whether the response is valid for redirecting; and logging
});
return false;
});
function StepCall(responseText, statusText, xhr, $form) {
if (responseText != "Negatory") { //"Negatory" would indicate no navigation
$form.parent('div').css("display", "none"); //doesn't seem to work, neither does "hide()"
$('#' + responseText).css("display", "block");
}
}
而且,我不知道如果我在正確的.ajaxSubmit success
回調使用$form
。有人知道嗎? website尚不清楚。
什麼是$ form? – SLaks 2010-09-03 21:22:09
再次,該網站是不是很清楚。我最好的猜測是它是一個表單DOM的jQuery對象包裝器。而且我不知道如何在這種情況下使用它來獲得表單的父分區並隱藏它。 – 2010-09-03 21:33:13