Working with jQuery.fileDownload.js plugin

Few days before I got help-request from one of my friend, they want to download the file using ajax calls.  I though of sharing jQuery.fileDownload.js plugin, which was created by johnculviner two years before.

What is jquery.fileDownload.js ?
Its a jQuery plugin which support cross server platform compatible, also works with multi browser. Support lots of methods like success and fail feature, which is like plug and play.

preparingMessageHtml
failMessageHtml
androidPostUnsupportedMessageHtml
dialogOptions
prepareCallback
successCallback
failCallback
httpMethod
data
popupWindowTitle

First we will include the jQuery library and file-download (jqueryfiledownload.apphb.com site).

<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script>
<script src="http://jqueryfiledownload.apphb.com/Scripts/jquery.fileDownload.js"></script>

We will add simple script which will download the file from it.

<script language="javascript">
$(document).on("click", "a.fileDownloadLink", function () {
    $.fileDownload("http://jqueryfiledownload.apphb.com/FileDownload/DownloadReport/2");
});
</script>

Here come’s our html part, will execute above script to download the file.

<a class="fileDownloadLink" href="javascript:;">Download</a>