•
•
•
•
What is DaniWeb IT Discussion Community?
You're currently browsing the JavaScript / DHTML / AJAX section within the Web Development category of DaniWeb, a massive community of 402,448 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,017 IT professionals currently interacting right now! Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our JavaScript / DHTML / AJAX advertiser: Lunarpages Web Hosting
Views: 3917 | Replies: 1
![]() |
•
•
Join Date: Jul 2006
Posts: 11
Reputation:
Rep Power: 3
Solved Threads: 0
Holla
I am using AJAX to load content into a section of my website. I would like the content that is loaded in to execute some javaScript. However, when i simply include it in the response, it doesn't get evaluated.
Say i request a page, test.htm. That page includes ONLY the following code:
Should this function not execute, and alert "Hello world?"
I am using AJAX to load content into a section of my website. I would like the content that is loaded in to execute some javaScript. However, when i simply include it in the response, it doesn't get evaluated.
Say i request a page, test.htm. That page includes ONLY the following code:
<script language="javaScript">
function testFunction(){
alert("HELLO WORLD");
}
testFunction();
</script>•
•
•
•
Holla
I am using AJAX to load content into a section of my website. I would like the content that is loaded in to execute some javaScript. However, when i simply include it in the response, it doesn't get evaluated.
Say i request a page, test.htm. That page includes ONLY the following code:
Should this function not execute, and alert "Hello world?"<script language="javaScript"> function testFunction(){ alert("HELLO WORLD"); } testFunction(); </script>
No the function will not execute. If you want that to run the script you will need to call a function after your response to "eval" the script for you.
Your new function will need to find and execute the script in the DOM.
pseudo code below
//put your response in a div or something and use the div id to grab the tag with a name = to script
divId.getElementsByTagName("script")
loop...
eval(script.innerHTML)Running this after you response will run all the scripts on your page.
Last edited by Sailor_Jerry : Aug 24th, 2006 at 5:37 pm.
![]() |
•
•
•
•
•
•
•
•
DaniWeb JavaScript / DHTML / AJAX Marketplace
•
•
•
•
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
- Ajax calls wont work in FireFox! (JavaScript / DHTML / AJAX)
- AJAX not working on firefox (JavaScript / DHTML / AJAX)
- Help about AJAX. (JavaScript / DHTML / AJAX)
- AJAX : Am i right with the concept? (JavaScript / DHTML / AJAX)
- AJAX techniques... (JavaScript / DHTML / AJAX)
- developers needed on anew special AJAX project (Web Development Job Offers)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Random sound/midifile with a button
- Next Thread: Date Validation in HTML


Linear Mode