Topic: What's violated with this window.open post-ajax call? (Page 1 of 1) Pages that link to <a href="https://ozoneasylum.com/backlink?for=30329" title="Pages that link to Topic: What&amp;#039;s violated with this window.open post-ajax call? (Page 1 of 1)" rel="nofollow" >Topic: What&#039;s violated with this window.open post-ajax call? <span class="small">(Page 1 of 1)</span>\

 
ruffy
Neurotic (0) Inmate
Newly admitted

From:
Insane since: Jun 2008

posted posted 06-15-2008 17:40

After an AJAX call to the server,
I wish to display the echoed results
in a pop up window.

Here's the segment handling the echo:

if (http.readyState == 4) {
results = http.responseText.split(",");
sesswin=window.open('sessionwindow.html','sessscr','height=300,width=350');
var tmp = sesswin.document;
tmp.write('<html><head><title>Session Report</title>');
...
tmp.write('</p></body></html>');
tmp.close();
if (window.focus) {tmp.focus()}
}


Why won't this work?
Why is the "tmp = ..." line of code giving me a "undefined value" error?

poi
Paranoid (IV) Inmate

From: Norway
Insane since: Jun 2002

posted posted 06-15-2008 18:23

Although the page you opens has a relative path and therefore does not throw a security exception when trying to access it, I wouldn't be surprised if its document were READONLY and possibily not exposed to JS.

What if you don't specify a URL in the window.open ? Also since you're going the Ajax road, why using a popup window anyway instead of updating an element in the current page ?

ruffy
Obsessive-Compulsive (I) Inmate

From:
Insane since: Jun 2008

posted posted 06-15-2008 18:50

Thanks for responding poi.

I removed the URL spec but I still come up with a
"sesswin is null" for the line that reads:
var tmp = sesswin.document;

In answer to your question,
I want to display a page with a session's results
once a session has been completed.

I initially thought to go to a new page,
but I could not send to it the parameters I received from the ajax's echo.

So now I think to display the echoed results via a pop up window.

The pop-up window code works when an event handler on the page is
clicked, but for some reason that I haven't figured out yet,
the window.open croaks if invoked on an ajax's echo.



Post Reply
 
Your User Name:
Your Password:
Login Options:
 
Your Text:
Loading...
Options:


« BackwardsOnwards »

Show Forum Drop Down Menu