?
错误之源:
$("a.consult").click(function () {
lib_consult_html = $(‘#consult-html‘).html(); /*复制了一份div*/
layer.open({
type: 1,
title: false,
closeBtn: 0,
shadeClose: true,
content: lib_consult_html /*这里写迷了吧*/
});
});
查看layer文档修改后:
$("a.consult").click(function () {
layer.open({
type: 1,
title: false,
closeBtn: 0,
shadeClose: true,
content: $(‘#consult-html‘)
});
});
然后div里的提交事件就生效了:
$(‘#model_click‘).click(function () {
var phone = $(‘#z_phone‘).val();
var budget = $(‘#z_budget‘).val();
var data = $("#model_form").serializeArray();
console.log(data);
if (phone != "" && budget != "") {
$.ajax({
url: ‘/tools/submit_ajax.ashx?action=my_modelSend‘,
dataType: "text",
type: ‘post‘,
data: data,
success: function (date) {
alert(date);
console.log(date);
document.getElementById("model_form").reset();
}
});
} else {
alert("联系电话和预算必填哦!!!");
}
});
?
原文地址:https://www.cnblogs.com/baocaige/p/10023693.html
时间: 2024-10-07 08:17:25