1

Can anyone help me to load response in to iframe using JQuery. I tried following ways.

$.post(url, $("formid").serialize(), function(data) {
$("#myIframe").contents().html(data);
})

I dont want to do

$(".myIframe").attr('src', "myServlet/"+encodedParam);

Because this will expose the data.And also in ie unable to load window with url having than 2038 characters. Thanks in advance.

sravs
  • 57
  • 1
  • 8
  • Take a look at http://stackoverflow.com/questions/4689145/pass-jquery-variables-between-iframe-and-parent – Anand G Mar 02 '17 at 05:28

2 Answers2

1

try to use $("#myIframe").contents().find('html').html(data);

Aminur Rashid
  • 741
  • 6
  • 13
1
var iframe = $("#Iframe")[0].contentWindow.document;
                iframe.open(); 
                iframe.write(data);
                iframe.close();

This solution worked for me Thanks a lot for responding:)

sravs
  • 57
  • 1
  • 8