[jQuery] Executing .load'ed functions
I'm dynamically generating a js function on the server-side, and loading that function into a DIV tag (I'll call this the 'div' function).
Immediately after defining the loaded 'div' function I call a previously defined js function which in turn will execute the newly loaded 'div' js function. This doesn't work. No errors, just doesn't work.
The simple test case below included the client side HTML, and a stub for the server-side.
On clicking the link loader() loads a div with a new js function loaded(), and calls a function tester(). tester() makes a call out to loaded() -- this does not work. Why?
==================
SERVER SIDE OUTPUT
<script type="text/javascript">
function loaded() {
alert("loaded");
}
alert("ready");
tester();
</script>
===================
HTML TEST PAGE
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title>test</title>
<script type="text/javascript" src="file:///c:/temp/jquery.js"></script>
<script type="text/javascript">
function tester(){loaded();}
function loader(){
$("#ldr").load("URL");
}
</script>
</head>
<body>
<a href="#" onclick="loader()">Go loader</a><br />
<div id="ldr"></div>
</body>
</html>
_______________________________________________
jQuery mailing list
discuss@jquery.com
http://jquery.com/discuss/