View Full Version : parsing javascript inside AJAX call

10-17-2008, 03:46 PM

I'm trying to open a new window using javascript in a page loaded through an AJAX call. I know this is tricky using escape() or eval(), but can't get it to work. The purpose is to have a page reload in the background to dynamically check for a change in the database, and if found, open a new browser window. It works with a link, but I need it to run by itself and <body onLoad> doesn't work in the innerHTML?

On parent page calling child using AJAX I have this:

function openWindow() {

window.open('http://www.google.com', 'checker', 'width=100px, height=100px, left=100px, top=100px');


inside the AJAX called page we have this:

<a href="##" onclick="openWindow()">click me</a>

Please Alien51, I know your out there. Please help:)

10-18-2008, 01:45 AM
I hope you thanked Alien, if he has helped you.

Your code may work from a link because the browser allows a new window to be created as the target of a link, but not as a purely scripted event.