I have a form with action ->
servlet and target -> iframe. The onload event for the iframe is set to a function that simply reads the text content of the frame:
[
<form method="post" src="MyServlet" target="uploadFrame" enctype="multipart/form-data" id="mainUploadForm">
....
</form>
<IFRAME id="uploadFrame" onload="resultUpload()" style="display:inline" name="uploadFrame" ></IFRAME>
<script>
document.getElementById("uploadFrame").onload = function() {doShowFrameContent(); }
</script>
]
Servlet processes form data and writes some text data (using response.writer) into the target/response:
[
...MyServlet code. doing some JSON stuff..
resp.getWriter().println(jsonStringer.toString());
]
Original calling page reads the iframe contents and displays text in an alert message.
Works fine in Firefox.
In IE7, data is written to the iframe (right-click on iframe, select "View Source", and I see the data in notepad).
But when I access the data, it returns empty html.
[
right-click on frame, and I see JSON data: {"result":"true","validDevices":0,"errorDevices":0,"companyDupes":26,"updatedDevices":0}
however, jscript code: alert(document.getElementById('uploadFrame').contentWindow.document.documentElement.outerHTML );
returns: <HTML><HEAD></HEAD><BODY> </BODY></HTML>
]
Note: I've used innerHTML as well, with the same result.
How can I access the {"result".....} data written to that iframe? "View Source" is doing it, how can I?
This is driving me nuts!!! Help!!!