问题
I imported the js file of this plugin from this site as follows
<script type="text/javascript" src="/gestionRH/js/jquery/jqueryFileDownload.js"></script>
and then
$.fileDownload('mypath');
Firebug shows me this error: TypeError: $.fileDownload is not a function
chrome shows this : Uncaught TypeError: Object function (a,b){return new d.fn.init(a,b,g)} has no method 'fileDownload'
this the whole code
<%@ page language="java" import="java.util.*" pageEncoding="ISO-8859-1"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script type="text/javascript" src="/gestionRH/js/jquery/jquery13_min.js"></script>
</head>
<body>
<input type="button" id="download" value="download">
</body>
<script type="text/javascript">
$("#download").live("click",function(){
$.fileDownload('C:\\Users\\free\\Desktop\\myworkspace\\gestionRH\\WebRoot\\fiches\\note.doc');
});
</script>
</html>
回答1:
for those who will face the same problem the problem is due to this : the path was not correct i have to download from a server so the path is
$.fileDownload('http://localhost:8080/path/to/file');
not $.fileDownload('C:\\Users\path\to\file');
来源:https://stackoverflow.com/questions/12267632/jquery-file-download-plugin