jQuery file download plugin

寵の児 提交于 2019-12-24 03:24:09

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!