我有一份工作表格。但是,为了完成一些JQuery操作(隐藏并显示div),我需要向表单添加一个id
标记。
当我添加id
时,jQuery按预期工作,但我的页面停止发布。
if ($_SERVER["REQUEST_METHOD"] == "POST") // this is working
POST working
<form method="post" action="<?php echo htmlspecialchars($_SERVER[" PHP_SELF "]);?>">
POST不工作-
<form method="post" id="target" action="<?php echo htmlspecialchars($_SERVER[" PHP_SELF "]);?>">
知道为什么会这样吗?
编辑- JQuery添加到下面。ID是唯一的.
$(document).ready(function() {
jQuery("#target").validationEngine('attach', {
onValidationComplete: function(form, status) {
if (status == true) {
document.getElementById("content").innerHTML = "its working";
document.getElementById("content1").innerHTML = "its working1";
//$(".form-bottom-section").hide();
// Set the effect type
var effect = 'slide';
// Set the options for the effect type chosen
var options = {
direction: 'right'
};
// Set the duration (default: 400 milliseconds)
var duration = 700;
//$('.form-bottom-section').toggle(effect, options, duration);
$('.order-bottom-section').toggle(effect, options, duration);
}
}
});
});
发布于 2016-06-07 13:27:49
jQuery-验证-引擎文档:https://github.com/posabsolute/jQuery-Validation-Engine#onvalidationcomplete
在定义时,它会在默认情况下停止表单的自动提交,并允许您通过函数处理验证状态。您也可以在此函数中返回true,表单将被允许提交。
因为您定义了这个回调,所以它将停止提交。
添加return true
将解决您的问题。
https://stackoverflow.com/questions/37680458
复制相似问题