2017-04-03 62 views
-1

如何從URL使用jQuery

<a href="files/doc_downloads/governance_docs/Whistleblower_and_Complaint_Policy.pdf" target="_blank" class="ModuleHeadlineLink"> 
 
    <span class="ModuleHeadline">Whistleblower and Complaint Policy</span> filesize 
 
</a>

+0

http://stackoverflow.com/a/1440804/1719752 –

回答

0

不知道有關細節您的應用程序中獲取文件大小,但我已經寫了我的應用程序,以獲取文件大小小一,而無需下載:

var req; 
    req = $.ajax({ 
    type: "HEAD", 
    url: $("#url").val(), 
    success: function() { 
     alert("Size is " + request.getResponseHeader("Content-Length")); 
    } 
    }); 

希望這會有所幫助。

+2

你寫了嗎? http://stackoverflow.com/a/1440804/1719752 –

+0

是的,我在我的應用程序。你想要我的github網址? –

+2

僅僅因爲它在你的github中,並不意味着你寫了它。如果這是它的工作原理,我是jQuery和Wordpress的作者 –