简体   繁体   中英

Download file with Javascript and upload to restful web service

I'd like to download a PDF file with JQuery/JS and then upload it to a WCF restful web service. Is this possible?

    $(document).ready(function () {
        $.get(HTML_FILE_URL, function (data) {
                debugger;
                $("#txt").val(data);
            });
        });

I have this code which returns something but it doesn't look enough content to be the PDF. It needs to be done with JS on the client as it will be used in Office 365 and I can't post to web services server side.

Please see the below project that uses Jquery to upload files to a server.

jQuery File Upload Demo

Also find some links that would guide you on how to perform POST/GET to a WCF Rest service via jquery

  1. http://blog.uniway.be/accessing-a-wcf-rest-service-through-jquery/

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM