`; htmlStr += ''; $('.showImg').append(htmlStr); imglist.push(fr.result) if (imglist.length == 2) { $('.boos').hide() } } fr.readAsDataURL(imgFile) } $(document).on('click', '.deleteImg', function() { $(this).parent().remove(); imglist.splice(this, 1); if (imglist.length == 1) { $('.boos').show() } }) $(document).on('click', '.leave_a_message', function() { $('.container').show() $('.img_show').hide() $('.information').show() $('#submit').show() $('.submit').hide() $('#sweet').hide() }) $(document).on('click', '.photo', function() { $('.container').show() $('.img_show').show() $('.information').hide() $('#submit').hide() $('.submit').show() $('#sweet').show() }) $(document).on('click', '#shut_down', function() { $('.container').hide() }) $(document).on('click', '.submit', function() { console.log('东西', imglist); if (imglist.length == 2) { if ($("input[name='names']").val() == "") { alert('姓名不能为空') return false } var url = window.location.href; console.log(url); $.post(url+"cms/p/feedphoto", { imglist: imglist, username: $("input[name='names']").val() }, function(res) { console.log(res); if (res.code == 1) { alert(res.msg) location.reload(); console.log('成功', res.msg); } else { alert(res.msg) console.log('失败', res.msg); } }); } else { alert('请上传两张图片') } }) $(document).on('click', '#submit', function() { console.log('表单', ); if ($("input[name='realname']").val() == "") { alert('姓名不能为空') return false } if ($("input[name='mobile']").val() == "") { alert('手机号不能为空') return false } var url = window.location.href; console.log(url); $.post(url+"cms/p/feedback", { username: $("input[name='realname']").val(), mobile: $("input[name='mobile']").val(), content: $("textarea[name='idcard']").val() }, function(res) { console.log(res); if (res.code == 1) { alert(res.msg) location.reload(); console.log('成功', res.msg); } else { alert(res.msg) console.log('失败', res.msg); } }); })