jquery - Javascript iFrame add to download file in IE7 and IE8 -
I need to download the file after the AJAX request. That's why I add an iframe to a page that posts some data into a webmath and a post's file. Here is the JavaScript code that is located on the button click handler:
var iframe = $ ("iframe id = 'PDFIframe' style = 'display: none' & gt; & lt; / Iframe & gt; "); Var iForm = $ ("form id = 'PDFForm' verb = 'App / billing.aspx / GetPDF' target = 'PDFIframe' method = 'post' target = '_ parent' & gt; & lt; / form & Gt; "). Html (input type = "hidden" name = "HtmlContent64" value = "'+ htmlcontent64 +'" /> & lt; input type = "hidden" name = "billing" value = "'+ This.billId + '"/>'); Iframe.append (iform); TempCmp.append (iframe); IForm.submit (); But in IE 7 and 8 there is a problem on the iframe.append (iForm) line. This one works on IE 9! What's wrong with my code? Edit: I learn more about this question, and this issue is probably because I tested different IE versions in IE9 like changing the value on the picture. Can Change Mode The Reason for This Problem? Maybe it works exactly in the IE 7 and 8 IE browser How do you think?
After spending a lot of time, I did not find a solution to my question but I found some solution that let me download files without any iFrame in IE7, IE8, IE 9, new page Help for opening etc. Here is the code:
jQuery.download = function (url, data, method) {// url and data options are required if (url & data) {// data can be Is the parameter or array / object data string = data type == 'string'? Data: jQuery. Ultimate (Data); // Form Inputs divided into parameters var inputs = ''; JQuery.each (data.split ('& amp;'), function () {var pair = this.split ('='); input + = '& lt; input type = "hidden" name = "' + Pair [0] + '"value ="' + pair [1] + '"/> gt;';}); // request request jquery ('
Comments
Post a Comment