我必须在选择特定下拉列表时显示模态弹出窗口,该模态包含表单。我想序列化该表单。我必须尝试下面的代码,但它没有工作,请任何人帮助我。提前谢谢。
<script>$("#seldist").change(function () {if ($(this).val() == "addcust") {
modal.style.display = "block";}});</script><form class="CustForm" name="CustForm" id="CustuserForm1" method="post" novalidate="novalidate"></form> <script>$(document).ready(function(){ $("button#AddCust").click(function(){var formdata=$("form[id='CustuserForm1']").serialize();alert(formdata);
$.ajax({type: "POST",url: "partials/customerAction.php",data: formdata,success: function(message){alert(message);},error: function(){alert("Error");
}});});});</script>