Link to home
Start Free TrialLog in
Avatar of Valleriani
VallerianiFlag for Sweden

asked on

Javascript/AJAX Eval(), How to load JAVASCRIPT after AJAX is called!

I am using the following snippet here:

http://www.developersnippets.com/2009/05/20/evaluate-scripts-while-working-on-ajax-requests/

Basically, for example, I have a index.php and a page that loads with ajax. we'll call that one ajaxpage.php . When theres no javascript in that page, its fine, But if I do something like..

HELLO THERE MATEY!<br>
<script language="JavaScript">
document.write("hello!<br>"):
</script>
OTHER STUFF AFTERWARDS

what ends up happening is everything but  document.write("hello!"): is called. so the page thats left is only

"hello!
"

But missing the any other additional HTML/PHP. But If I load up  ajaxpage.php. It will display properly, aka:

"HELLO THERE MATEY!
hello!
OTHER STUFF AFTERWARDS"

Basiclly, I'm trying to figure out how ajax can do this properly.

I've also tried to use a countdown script located here: http://www.dynamicdrive.com/dynamicindex6/dhtmlcount.htm

Which again works great if you load the ajaxpage.php directly, but if you do the index.php page that loads the ajaxpage.php file, the result is BLANK.. So I'm guessing there is an issue using EVAL here .. Any suggestions? Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Zyloch
Zyloch
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Valleriani

ASKER

Hm Thanks.

The issue is I need a REAL countdown timer on a page that updates every 60 seconds. it must countdown from 60 to 0 basiclly. However, most of the 'update content' is in the 'ajaxpage.php file'.. Not sure what I can do :\ It has to be 'real updates' without a refresh style update, which is quote a pain to do (For work, boss wanted 'live numbers' that don't refresh the whole page so it doesn't scroll away etc)

When I load it without adding the snippit, it works fine and dandy!