clock  Mon - Sun 8.00 AM - 8.00 PM
fb
instagram
play store
pinterest

How to Download File using jQuery?

writter  Sumit Dey Sarkar
Date  27 Nov 2022
Language  JQuery
How to Download File using jQuery?

How to Download File using jQuery?

In this tutorial we will learn how to download file using jQuery?

Here we will use window.location to download any file or image using jQuery.

 

Let's see an example -

 

How to download file using jQuery?

<!DOCTYPE html>
<html>
<head>
    <title>How to Download File using jQuery?</title>
</head>
<body>
  
    <h1>How to Download File using JQuery?</h1>
  
    <a class="downloadUsingJquery" href="#">Download Now</a>
  
</body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script type="text/javascript">
    $(document).ready(function () {
        $(".downloadUsingJquery").click(function (e) {
            e.preventDefault();
            window.location.href = "https://teknowize.com/attachments/file_1669493714.png";
        });
    });
</script>
  
</html>