$("#submit").click(function () { var regexemail = /^[_a-z0-9-]+(\.[_a-z0-9-]+)*@[a-z0-9-]+(\.[a-z0-9-]+)*(\.[a-z]{2,})$/; var regextel = /^([1]\d{10}|([\((]?0[0-9]{2,3}[)\)]?[-]?)?([2-9][0-9]{6,7})+(\-[0-9]{1,4})?)$/; var uname = $("#uname").val(); var uphone = $("#uphone").val(); var uemail = $("#uemail").val(); var uaddress = $("#uaddress").val(); var ucontent = $("#ucontent").val(); if (uname == "" || uname == null) { layer.msg("请输入您的姓名", { time: 3000 }); } else if (uphone == "" || uphone == null) { layer.msg("请输入您的电话", { time: 3000 }); } else if (!regextel.test(uphone)) { layer.msg("请输入正确的电话", { time: 3000 }); } else if (uemail == "" || uemail == null) { layer.msg("请输入您的邮箱", { time: 3000 }); } else if (!regexemail.test(uemail)) { layer.msg("请输入正确的邮箱", { time: 3000 }); } else if (uaddress == "" || uaddress == null) { layer.msg("请输入您的地址", { time: 3000 }); } else if (ucontent == "" || ucontent == null) { layer.msg("请输入您的建议或反馈", { time: 3000 }); } else { $.ajax ( { async: false, datatype: 'json', type: "post", url: "/ajax/feedbackhandlercn.ashx", data: {uname: uname, uphone: uphone, uemail: uemail, uaddress: uaddress, ucontent: ucontent}, success: function (data) { if (data.code == "ok") { layer.msg(data.msg, { time: 3000 }); $("#uname").val(""); $("#uphone").val(""); $("#uemail").val(""); $("#uaddress").val(""); $("#ucontent").val(""); } } } ); } })