0

Hello. I am using an iframe in my page to submit a form to so that it can upload a file - since you can't do this through the jquery ajax function. I have everything working, but I want to be able to hide the iframe and get the content of it, and put just the content inside of it into another div on the page.

I have tried alot of things, but I think this one was probably closest:

$("#myframe")[0].contentDocument;

This ended up getting me a value type of "Object HTMLDocument", I just can't figure out how to get the content as a string so that I can put it into the div I want.

Thank you for any help you can give me!

4
Contributors
5
Replies
18
Views
6 Years
Discussion Span
Last Post by kiranmaijalem
0

I have continued to look around for a solution, and I re-ran my page again and realized that I was being alerted of the iFrame content before that content was in the iFrame to begin with. So what I did was looked to see if the iFrame had been completely loaded, then I got the content and put it where I wanted it.

Code:

function getIframeContents(){
	$("#fileuploadframe").load(function(){
		response = $("#fileuploadframe").contents().find("#returnValue").html();
		alert(response);
		$("#responses").html(response).show();
	});	
}

This function is fired onsubmit of a form.

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.