├── CHANGELOG.md ├── LICENSE ├── README.md ├── bower.json ├── package.json └── src ├── ajaxdownloader.js └── ajaxdownloader.min.js /CHANGELOG.md: -------------------------------------------------------------------------------- 1 | # Change Log 2 | All notable changes to this project will be documented in this file. 3 | 4 | The format is based on [Keep a Changelog](http://keepachangelog.com/) 5 | and this project adheres to [Semantic Versioning](http://semver.org/). 6 | 7 | 8 | ## v1.1.0 - 2016-11-12 9 | ### Added 10 | - Bower and npm support 11 | - SemVer compliant 12 | - Changelog 13 | 14 | 15 | 16 | ## v1.0 - 2015-05-04 17 | *First public release* 18 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015-2016 Gaspare Sganga 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # jQuery AjaxDownloader 2 | A jQuery Plugin to perform Ajax style downloads 3 | 4 | --- 5 | 6 | Documentation and examples at http://gasparesganga.com/labs/jquery-ajax-downloader/ 7 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gasparesganga-jquery-ajax-downloader", 3 | "description": "A jQuery Plugin to perform Ajax style downloads", 4 | "homepage": "http://gasparesganga.com/labs/jquery-ajax-downloader/", 5 | "authors": [ 6 | "Gaspare Sganga (http://gasparesganga.com)" 7 | ], 8 | "license": "MIT", 9 | "keywords": [ 10 | "ecosystem:jquery", 11 | "jquery-plugin", 12 | "jquery", 13 | "plugin", 14 | "ajax", 15 | "downloader" 16 | ], 17 | "main": [ 18 | "src/ajaxdownloader.js" 19 | ], 20 | "repository": { 21 | "type": "git", 22 | "url": "https://github.com/gasparesganga/jquery-ajax-downloader.git" 23 | }, 24 | "moduleType": [ 25 | "globals" 26 | ], 27 | "dependencies": { 28 | "jquery": ">=1.7.0" 29 | }, 30 | "ignore": [ 31 | "package.json" 32 | ] 33 | } -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "gasparesganga-jquery-ajax-downloader", 3 | "version": "1.1.0", 4 | "description": "A jQuery Plugin to perform Ajax style downloads", 5 | "homepage": "http://gasparesganga.com/labs/jquery-ajax-downloader/", 6 | "author": "Gaspare Sganga (http://gasparesganga.com)", 7 | "license": "MIT", 8 | "repository": { 9 | "type": "git", 10 | "url": "https://github.com/gasparesganga/jquery-ajax-downloader.git" 11 | }, 12 | "bugs": { 13 | "url": "https://github.com/gasparesganga/jquery-ajax-downloader/issues" 14 | }, 15 | "keywords": [ 16 | "ecosystem:jquery", 17 | "jquery-plugin", 18 | "jquery", 19 | "plugin", 20 | "ajax", 21 | "downloader" 22 | ], 23 | "dependencies": { 24 | "jquery": ">=1.7.0" 25 | } 26 | } -------------------------------------------------------------------------------- /src/ajaxdownloader.js: -------------------------------------------------------------------------------- 1 | /*************************************************************************************************** 2 | AjaxDownloader - A jQuery Plugin to perform Ajax style downloads 3 | Author : Gaspare Sganga 4 | Version : 1.1.0 5 | License : MIT 6 | Documentation : http://gasparesganga.com/labs/jquery-ajax-downloader/ 7 | ****************************************************************************************************/ 8 | (function($, undefined){ 9 | $.AjaxDownloader = function(options){ 10 | // Settings 11 | var settings = $.extend(true, {}, { 12 | data : $.ajaxSetup()["data"] || {}, 13 | url : $.ajaxSetup()["url"] 14 | }, options); 15 | 16 | // Create Form 17 | var form = $("
", { 18 | action : settings.url, 19 | method : "POST", 20 | target : "AjaxDownloaderIFrame", 21 | }).appendTo("body"); 22 | 23 | // Append Data 24 | $.each(settings.data, function(key, val){ 25 | $("", { 26 | type : "hidden", 27 | name : key, 28 | value : (typeof val == "object") ? JSON.stringify(val) : val 29 | }).appendTo(form); 30 | }); 31 | 32 | // Submit Form 33 | form.submit(); 34 | form.remove(); 35 | }; 36 | 37 | // Create AjaxDownloaderIFrame 38 | $(document).ready(function(){ 39 | $("