提交表单后显示模式对话框 - php

提交下载文件后,我有一张表格。我要自动而不是自动下载文件..以显示模态对话框并显示下载链接。

<form name="softwareform" id="softwareform" action="../downloadlink.php" method="POST" align="left">
  <div class="input-group margin-bottom-sm">
      <span class="input-group-addon">
         <i class="fa fa-windows fa-fw"></i>
      </span>
      <input class="form-control" type="text" placeholder="Software Title" name="softtitle" id="softtitle">
  </div>

  <button type="submit" class="btn btn-primary"  >
      <i class="fa fa-cogs"></i>Download File
  </button>
</form>

在下载link.php中,我将使用标头将进程重定向到下载文件。
这是我要显示的模式对话框。

<div class="modal fade bs-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
   <div class="modal-dialog modal-sm">
      <div class="modal-content" id="dialog-download">
         <br/><br/>
         <h2>Your Download is ready.</h2>
         <hr/>
         Your Download link is here <br/>
      </div>
   </div>
</div>

提交表单后如何显示此对话框?
提前致谢

php大神给出的解决方案

$("#softwareform").submit(function(e){
    e.preventDefault();
    $.ajax({
        type : 'POST',
        data: $("#softwareform").serialize(),
        url : 'url',
        success : function(data){
            $("#download_link").html(data);
            $("#download_modal").modal("show");
        }
    });
    return false;
});

<div id="download_modal" class="modal fade bs-modal-sm" tabindex="-1" role="dialog" aria-labelledby="mySmallModalLabel" aria-hidden="true">
    <div class="modal-dialog modal-sm">
        <div class="modal-content" id="dialog-download">
            <br/><br/><h2>Your Download is ready.</h2>
            <hr/>
             Your Download link is here<a id="download_link" target="_blank"> </a>
            <br/>
        </div>
     </div>
</div>

为了显示模态,使用函数modal(“ show”)。

在此处提交表单时,从php文件返回下载链接,它将通过jquery填充,并且将显示模式,当用户单击该链接时,将下载文件

还签出jsfiddle:-http://jsfiddle.net/h3WDq/559/

资源 :-
How to open a Bootstrap modal window using jQuery?

您可以将方法更改为POST并使用序列化表单从表单发送数据。

验证php中的javascript对象 - php

在我的用户界面中,用户可以构建一些javascript对象,例如:var box = { "width": "100px", "height": "200px", "click": function () { alert("You clicked t…

哪个更好的做法?从Jquery响应获取HTML - php

这只是一个问题,以了解人们如何以及如何做到这一点,但是假设用户向列表中添加了一些内容,完成后,它将运行下面的ajax并更新.user-stream-list$.ajax({ url: "user-stream-list.php", success: function(data){ $(".user-stream-list…

为什么我的注册表单可以在除Firefox之外的所有浏览器中使用? - php

在这里可用:http://syllableapp.com/test基本上,在Safari,Chrome,Opera,Webkit Nightly等中,表单可以完美地按预期工作。但是,在Firefox中,提交时只是...不执行任何操作。为什么是这样?这是我的JavaScript:$(document).ready(function() { $('in…

在Codeigniter中以数组形式获取查询结果 - php

我有一个查询,如何获取结果作为数组? php大神给出的解决方案 像这样:$rs = $this->db->query(...); $array = $rs->result_array(); https://www.codeigniter.com/user_guide/database/results.html

将python scikit学习模型导出到pmml - python

我想将python scikit-learn模型导出到PMML。哪个python软件包最合适?我阅读了有关Augustus的内容,但是我无法使用scikit-learn模型找到任何示例。 python大神给出的解决方案 SkLearn2PMML是 JPMML-SkLearn命令行应用程序周围的薄包装。有关受支持的Scikit-Learn Estimator和…