PDA

View Full Version : evaluating javascript in an ajax response



tfish77
04-04-2007, 03:01 PM
1) Script Title:
Ajax Tabs Content script

2) Script URL (on DD):
http://www.dynamicdrive.com/dynamicindex17/ajaxtabscontent/

3) Describe problem:
I am a relative javascript/ajax n00b, and I have what I'm sure is a common problem, but I have been unable to solve it. I am using the Ajax Tabs script to load up different pages from my site in a nice tabbed interface. Some of my target URLs contain javascript. When the innerHTML replacement occurs, that javascript is inserted into the page (along with all the HTML from my target URL), however, it does not run. I know that the "eval()" function is probably required here, but I do not know what the best practice is for using it in this scenario.

I would greatly appreciate any help. Thank you.

jscheuer1
04-04-2007, 03:34 PM
To anyone with much javascript experience, eval() is about as close as you can get to evil in a scripting language. Besides that, I cannot imagine how it could help in this situation which has been covered quite a bit in these forums. Lacking a specific example, and considering that you say you are new to all of this, I would direct you here:

http://www.dynamicdrive.com/forums/showthread.php?t=17426

If you need more help, a link to your problem page and an explanation of the details of the problem would facilitate matters.

tfish77
04-04-2007, 04:05 PM
jscheuer1,

Thank you for the link. I had searched through these forums, but my problem was that I didn't know enough to be using the correct search terms. I'm going to go off now and do some reading.

Thanks again.