jQuery.download = function(targetId, url, data, method){ function escapeHtmlEntities (str) { if (jQuery !== undefined) { // Create an empty div to use as a container, // then put the raw text in and get the HTML // equivalent out. return jQuery('
').text(str).html(); } // No jQuery, so use string replace. return str .replace(/&/g, '&') .replace(/>/g, '>') .replace(//g, '>') .replace(/'; }); //send request if ($("#"+targetId).length == 0) { jQuery("").appendTo('body'); } jQuery('
'+inputs+'
') .appendTo('body').submit().remove(); }; };