我从this site导入了此插件的js文件,如下所示
<script type="text/javascript" src="/gestionRH/js/jquery/jqueryFileDownload.js"></script>
然后
$.fileDownload('mypath');
Firebug向我显示此错误:TypeError: $.fileDownload is not a function
chrome显示:未捕获TypeError: Object function (a,b){return new d.fn.init(a,b,g)} has no method 'fileDownload'
这是整个代码
<%@ 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>
答案 0 :(得分:3)
对于那些将面临同样问题的人来说问题是由于这个:路径不正确我必须从服务器下载所以路径是
$.fileDownload('http://localhost:8080/path/to/file');
不是$.fileDownload('C:\\Users\path\to\file');