{extend name="$index_style_layout" /} <!--SEO相关--> {block name="head_title"}{$info.title}{/block} {block name="head_keword"}{$info.keywords?:$info.title} {$s_info.name} {/block} {block name="head_description"}{:get_word(del_html($info['content']),300)}{/block} {block name="nav"}{qb:nav title="留言本" url="" /}{/block} <link type="text/css" rel="stylesheet" href="__STATIC__/plugins/guestbook/guestbook.css"/> {block name="body_content"} <header> <div class="header-single-post" data-dsn-header="project"> <div class="post-parallax-wrapper" data-overlay="3"> <img id="dsn-hero-parallax-img" class="w-100 has-top-bottom" src="/assets/img/project/slide1.jpg" alt="" data-dsn-header="blog" data-dsn-ajax="img"> </div> <div class="container"> <div class="inner-box m-section"> <h3 class="title-box mt-10">在线预定门票</h3> </div> </div> </div> </header> <link rel="stylesheet" href="__STATIC__/plugins/guestbook/global.css" /> <link rel="stylesheet" href="__STATIC__/icon/icon.css" type="text/css"> <script type="text/javascript" src="__STATIC__/js/core/jquery.min.js"></script> <script type="text/javascript" src="__STATIC__/layer/layer.js"></script> {qb:tag type="guestbook" union="fid" name="guestbook_list01" rows="5" order="list"} {php}if($rs['status']==0&&(($userdb['groupid']!=3&&$userdb['uid']!=$rs['uid'])||empty($userdb)))continue;{/php} {/qb:tag} <div class="wrapper"> <div class="container"> <div class="news-content"> <div class="news-content-inner"> <div class="News-socials-wrapper"> <div> <div class="post-share"> <h5 class="title-caption">快捷连接:</h5> <ul> <li><a href="http://360.blueroofmuseum.com/" target="_blank">在线展厅</a></li> <li><a href="/page/1.html" target="_blank">展馆场地</a></li> <li><a href="/page/2.html" target="_blank">联系信息</a></li> </ul> </div> </div> </div> <div class="post-content"> <h5>疫情防控注意事项</h5> <blockquote class="wp-block-quote"> <p><strong>1. 本次展览为预约免费展览,请提前预约;</strong></p> <p><strong> 2. 入场前需出示健康码,行程码不能带星号,并进行体温检测,如有体温异常(≥37.3℃), 或有咳嗽,气促等异常症状的观众谢绝入场,并建议寻求医疗帮助;</strong></p> <p style="font-size:25px;text-decoration:underline;"><strong> 3. 入场前需持有48小时核酸检测报告;</strong></p> <p><strong> 4. 预约门票请填写下方信息。</strong></p> </blockquote> </div> </div> <div class="comments-post m-section"> <div class="comments-form"> <div class="comments-title"> <h4 class="subtitle">预定门票</h4 class="subtitle"> </div> <form name="form1" method="post" action="{:auto_url('wxapp.post/add')}"> <div class="entry"> <label>姓名:</label> <input id="form_name" type="text" name="linkman" placeholder="输入您的名字" required="required" data-error="名字是必须输入的."> </div> <div class="entry"> <label>手机号码:</label> <input id="form_tel" type="text" name="telphone" placeholder="输入您的电话" required="required" data-error="电话是必须输入的."> </div> <div class="entry"> <label>证件号码:</label> <input id="form_sn" type="text" name="content" placeholder="输入您的身份证号码" required="required" data-error="证件是必须输入的."> </div> <div class="entry"> <label>有什么要对我们说吗?</label> <textarea id="" class="form-control" name="gb_message" placeholder="可以写上您的备注或者留言" data-error="您的备注"></textarea> </div> <div class="submit-div image-zoom" data-dsn="parallax"> <span><input type="submit" name="Submit" class="custom-btn" value="提 交"></span> <input type="hidden" name="fid" value="{$fid}"> </div> </form> </div> </div> </div> </div> </div> <script type="text/javascript"> $(document).ready(function(){ var more_url = "{qb:url name='guestbook_list01' /}"; var havepost = false; $('form.ajax-post').submit(function () { var form_data = $(this).serialize(); if(havepost==true){ layer.msg('请不要重复提交'); return ; } var url = $(this).attr('action'); havepost = true; $.post(url, form_data).success(function (res) { if(res.code==0){ layer.msg("发表成功!"); window.location.reload(); }else{ havepost = false; layer.alert('提交失败:' + res.msg); } }).fail(function () { havepost = false; layer.alert('服务器发生错误'); }); return false; }); var page=1; $(".viewmore").click(function(){ page++; var that = $(this) $.get(more_url+page,function(res){ if(res.code==0 && res.data!=''){ $(".guestbook_list").append(res.data); }else{ layer.msg('没有了!'); that.hide(); } }); }); }); var delete_url = "{:auto_url('wxapp.post/delete')}"; function delele_topic(id){ $.get(delete_url+"?id="+id,function(res){ if(res.code==0){ layer.msg('删除成功'); setTimeout(function(){window.location.reload();},800); }else{ layer.alert(res.msg); } }); } </script> {/block}
在模板底部加入下面的代码试试吧。
因为你提交的URL必须要通过AJAX方式提交才行的。
<script type="text/javascript"> $(function(){ $('form').submit(function () { var form_data = $(this).serialize(); if(havepost==true){ layer.msg('请不要重复提交'); return ; } var url = $(this).attr('action'); havepost = true; $.post(url, form_data).success(function (res) { if(res.code==0){ layer.msg("发表成功!"); window.location.href="http://www.baidu.com"; //换成你自己想要的网址 }else{ havepost = false; layer.alert('提交失败:' + res.msg); } }).fail(function () { havepost = false; layer.alert('服务器发生错误'); }); return false; }); }); </script>