So i am developing in Coldfusion and asynchronous javascript . If i define a javascript function in my topmost page (the one in the url) any part of the page (a div who’s inner html has been populated by AJAC) can see that function. However, if one of these divs which has been populated by AJAC tries to define its own function, by having the following in its html
<script type=”text/javascript”>
function foobar() {
window.alert(“Hello World”);
}
</script>
and call that function via an onclick (or any other event) i get
Error: foobar undefined.
I have tried giving the script an id, and appending it as a child to the documents Head, i have tried appending its text to an existing script in the documents head who’s other functions work, foobar remains undefined. There is probably a simple fix, i probably phrased this poorly, please help if you can.