本文介绍了jQuery文件下载插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我从如下
< script type =text / javascriptsrc =/ gestionRH / js / jquery / jqueryFileDownload.js>< / script>
然后
$.fileDownload('mypath');
Firebug显示这个错误: TypeError:$ .fileDownload不是一个函数
Firebug shows me this error: TypeError: $.fileDownload is not a function
chrome显示此内容:未捕获 TypeError:Object function(a,b){return new d.fn.init (a,b,g)}没有方法'fileDownload'
chrome shows this : Uncaught 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>
推荐答案
对于那些面临同样问题的人,问题是由于这个原因:路径不正确我必须从服务器下载路径是
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');
不是 $。fileDownload('C:\\Users\ path \to\file');
这篇关于jQuery文件下载插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!