forked from Kat-Attack/exportExcel
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
30 lines (29 loc) · 942 Bytes
/
index.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<html>
<head>
<title>ExcelSample</title>
</head>
<body>
<button type="button" id="download-button" >Export into Excel</button>
</body>
<script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
</html>
<script>
$(document).ready(function(){
var downloadButton = document.getElementById("download-button");
downloadButton.onclick = function(argument) {
$.ajax({
url: 'getexcel',
type: 'POST',
cache: false,
async: false,
success: function(response) {
//this line downloads the file to the client's side.
window.location.href = "/sample.xlsx";
},
error: function(err){
console.log(err);
}
});
};
});
</script>