Pbootcms-提交信息后下载Pdf文件

{pboot:if({content:enclosure} != '')}

              <div class="download">

                <p class="title">文件下载</p>

              

<a href="javascript:;" download="{content:title}" id="filedownload" class="filedownload"><span class="tb"><svg t="1718981941482" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4289" width="16" height="16"><path d="M511.985404 988.20397L354.645856 830.863205l31.692198-31.692197 125.64735 125.646134 125.647351-125.646134 31.693414 31.692197z" fill="#c56c2a" p-id="4290"></path><path d="M489.574876 549.16438h44.821057v390.984362h-44.821057z" fill="#c56c2a" p-id="4291"></path><path d="M802.862512 498.506247a292.347627 292.347627 0 0 0 3.606362-45.781943c0-160.264776-129.920251-290.18381-290.183811-290.183811-156.325145 0-283.755607 123.617328-289.927168 278.428166-98.420231 18.360213-172.926572 104.690313-172.926573 208.435553 0 117.112497 94.937933 212.051646 212.051646 212.051646l0.254209-0.002433v0.002433h50.690974v-44.821058H265.760287v-0.003649c-0.09244 0-0.184879 0.003649-0.278535 0.003649-44.669019 0-86.664586-17.394462-118.249748-48.98084-31.585162-31.585162-48.980841-73.580729-48.980841-118.249748s17.394462-86.664586 48.980841-118.249748c22.566216-22.566216 50.447712-37.88322 80.820212-44.794298a168.56853 168.56853 0 0 1 37.429536-4.186542c2.410728 0 4.811726 0.060816 7.205426 0.161769a249.539565 249.539565 0 0 1-1.764867-29.609873c0-5.121885 0.173932-10.217012 0.484091-15.286596 3.651365-59.787763 28.659934-115.491154 71.381639-158.211643 46.342662-46.342662 107.959757-71.865731 173.498239-71.86573 65.539698 0 127.155576 25.521852 173.498238 71.86573 46.342662 46.342662 71.865731 107.959757 71.865731 173.498239 0 16.313162-1.583637 32.383062-4.674283 48.035767a242.757415 242.757415 0 0 1-12.339474 42.018677h43.569473v0.029192c0.211638-0.001216 0.420844-0.013379 0.632482-0.01338 1.11779 0 2.233147 0.014596 3.346071 0.041355 35.320453 0.841687 68.400461 14.992248 93.471062 40.062849 25.861203 25.861203 40.102987 60.24388 40.102987 96.817133 0 36.573253-14.241785 70.95593-40.102987 96.817133-25.861203 25.861203-60.245096 40.102987-96.817133 40.102987l-0.063248-0.001216v0.001216h-72.483617v44.821057h76.492577v-0.049868c98.550376-2.099353 177.796681-82.63738 177.796682-181.691309-0.002433-95.656772-73.899403-174.050444-167.718329-181.210866z" fill="#c56c2a" p-id="4292"></path></svg></span><span id="lkxz">{content:title}</span></a>

<!--Form开始20240926-->

<link rel="stylesheet" href="/static/css/add_form.css">

<div class="accordion ui-accordion-content ui-corner-bottom ui-helper-reset ui-widget-content ui-accordion-content-active show-form" id="ui-id-2" aria-labelledby="ui-id-1" role="tabpanel" aria-hidden="false" style="">

    <div>

        <!-- indexer::stop -->

        <div class="ce_form block">

            <form method="post" id="myForm">

                <div class="formbody">

                    

                    <div class="widget widget-checkbox">

                        <fieldset  class="checkbox_container">

<span><input type="checkbox" name="pro_type[]" id="opt_646_0" 

class="checkbox" value="高压开关柜"> <label id="lbl_646_0" for="opt_646_0">高压开关柜</label></span>

                            <span><input type="checkbox" name="pro_type[]" id="opt_646_1" class="checkbox" value="低压开关柜">

<label id="lbl_646_1" for="opt_646_1">低压开关柜</label></span>

                            <span><input type="checkbox" name="pro_type[]" id="opt_646_2" class="checkbox" value="高低压元器件"> 

<label id="lbl_646_2" for="opt_646_2">高低压元器件</label></span>

                  

                        </fieldset>

                    </div>

                    <div class="widget widget-text mandatory">

                        <input type="text" name="company" class="text mandatory" value="" required="" placeholder="公司*">

                    </div>

                    <div class="widget widget-text mandatory">

                        <input type="text" name="email" class="text mandatory" value="" required="" placeholder="邮箱*">

                    </div>

                    <div class="widget widget-text mandatory">

                        <input type="text" name="contact" class="text mandatory" value="" required="" placeholder="联系电话*">

                    </div>

                    

                   

                    <div class="widget widget-explanation explanation">

                        <p><small>*提交上述信息,立刻获取下载链接</small>

                        </p>

                    </div>

                    <div class="widget widget-submit">

                        <button type="submit" class="submit">提交</button>

                    </div>

                </div>

            </form>

        </div>

        <!-- indexer::continue -->

    </div>

</div>


<!--Form结束20240926-->

  </div>

              {/pboot:if}

<script>

$(function(){

$('#filedownload').click(function(){

$('.show-form').slideToggle();

})

})

//表单提交

$('#myForm').submit(function(event) {

    event.preventDefault();

var formData = $('#myForm').serialize();

$.ajax({

  type: 'POST',



  url: '/form/3/', 



  data: formData,



  success: function(response) {


var downloadurl = '{content:enclosure}';

alert('提交成功,请再次点击文件即可下载!');

$('.show-form').remove();

$('#filedownload').attr('href',downloadurl);

$('.filedownload').removeAttr('id');

$('#lkxz').append('<br><em style="color:blue;">【立刻下载】<em>');

  },



  error: function(xhr, status, error) {



console.error('Error:', error);



  }



});

  



});

</script>



本文关键词:

联系我们

在线咨询:点击这里给我发消息

邮件:w420220301@qq.com