| | |
Ajax - evaluate scripts in response
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Jul 2006
Posts: 11
Reputation:
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:
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<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?"JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
<script language="javaScript"> function testFunction(){ alert("HELLO WORLD"); } testFunction(); </script>
Your new function will need to find and execute the script in the DOM.
pseudo code below
JavaScript / DHTML / AJAX Syntax (Toggle Plain Text)
//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 6:37 pm.
![]() |
Similar Threads
- 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
| Thread Tools | Search this Thread |
ajax ajaxcode ajaxexample ajaxhelp ajaxjspservlets animate automatically beta box browser bug calendar captchaformproblem checkbox child class close column createrange() css cursor debugger dependent disablefirebug dom download dropdown editor element embed engine error events explorer ext file form forms getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 ie8 iframe images internet java javascript javascripthelp2020 jawascriptruntimeerror jquery jsf jsfile jump libcurl math media microsoft mimic object onmouseoutdivproblem onreadystatechange parent paypal pdf php player position post problem programming progressbar regex runtime scroll search security select session shopping size software sql text textarea unicode w3c web website window windowofwords windowsxp wysiwyg \n





