淡出成功消息后如何下载PDF?

时间:2017-06-15 07:22:18

标签: php email magento controller

我正在使用表单向用户提交电子邮件和姓名。提交表单邮件触发和成功消息显示后。 10秒后成功消息淡出,即罚款。现在我想在淡出成功消息之后下载一个pdf。

我通过行动实现这一目标。

我正在使用以下代码:

<form class="brochure brochure_1" method="post" id="custom_contact_form" action="http://example.com/contact/index/contact" onsubmit="return validateForm();" name="myForm">
        <div class="input-box">
            <input type="hidden" readonly="readonly" class="input-text required-entry toname" value="" name="toname"/>
            <input type="hidden" value="<?php echo $this->getFromUrl(); ?>" name="submiturl" class="submiturl" />
        </div>
            <input type="text" class="input-text required-entry" value="" name="name" placeholder="Name"/>
            <input type="text" class="input-text required-entry" value="" name="email" placeholder="Email"/>
        <span><input type="submit" value="Download" /></span>
    </form>
<script>
function validateForm() {
    var name = document.forms["myForm"]["name"].value;
    if (name == "") {
        alert("Name must be filled out");
        return false;
    }

    var email = document.forms["myForm"]["email"].value;
    var atpos = email.indexOf("@");
    var dotpos = email.lastIndexOf(".");
    if (email == "") {
        alert("Email must be filled out");
        return false;
    }
    else if (atpos<1 || dotpos<atpos+2 || dotpos+2>=x.length) {
        alert("Not a valid e-mail address");
        return false;
    }
}

jQuery('.success-msg').insertBefore(jQuery( ".breadcrumbs" ));
 jQuery(document).ready(function(){
        setTimeout(function() {
          jQuery('.success-msg').fadeOut('fast');
        }, 10000); // <-- time in milliseconds
    });
</script>

1 个答案:

答案 0 :(得分:0)

像这样替换文档,

   app.run(function($templateCache) {
 $(window).on('beforeunload', function() {
     $templateCache.removeAll();
 });
});
 app.run(function($rootScope, $templateCache) {
   $rootScope.$on('$viewContentLoaded', function() {
      $templateCache.removeAll();
   });
});