Here is what I am trying to do
1) Click on download pdf link.(There are list of pdfs) 2) On click Popup will open. Contact form is in the popup. 3) On submit button send mail and auto start download of PDF file. 4) At the same time of starting of download close the popup without redirecting to any page.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Download</title>
<!-- Bootstrap -->
<link href="css/bootstrap.min.css" rel="stylesheet">
</head>
<body>
<div class="container">
<div class="row">
<a href="#" class="btn btn-primary" data-toggle="modal" data-target="#download">Download</a>
<!-- modal for download and contact -->
<div class="modal fade" id="download" role="dialog" >
<div class="modal-dialog" >
<div class="modal-content">
<!-- Your contact form goes here -->
<form method="post">
<input type="text" id="name" placeholder="name">
<input type="text" id="email" placeholder="email">
<button onclick="send();">send</button>
</form>
</div></div></div>
</div>
</div>
<!-- jQuery (necessary for Bootstrap's JavaScript plugins) -->
<script src="js/jquery.js"></script>
<!-- Include all compiled plugins (below), or include individual files as needed -->
<script src="js/bootstrap.min.js"></script>
<script>
function send(){
var name = $("input#name").val();
var email = $("input#email").val();
$.ajax({
type: "POST",
url: "send.php", //your mailing code is place on send.php
data:'name='+ name'&email='+email,
success: function(data){
$('#download').modal('hide');
//window.open('pdf/fabrilinx-Sodium-Hydrosulphite.pdf');
window.location.href='pdf/fabrilinx-Sodium-Hydrosulphite.pdf'; //your file location
}
});
}
</script>
</body>
</html>
Problem occurs with this code
1) onclick download button, after entering detail pdf wont open in new window 2) How to download same pdf on witch user click, if there are multiple pdf download buttons are there
i have taken this code reference from another post but neither it works nor i have enough points to comments there.
On click open popup with form and then on submit download and close it! How?
Please anyone can help me to get the solution??