Skip to content

Instantly share code, notes, and snippets.

<html>
<head>
<title>Ajax JavaScript Includer</title>
<script type='text/javascript' src='jquery-1.3.2.min.js'></script>
<script type='text/javascript'>
//We have to declare a global object that we will use as a namespace for storing
//the eval loaded functions and variables, otherwise they will only exist within
//the scope of the ajax response function, which is be useless.
fooNamespace.outputFoo = function()
{
alert(fooNamespace.foo);
}
fooNamespace.foo = 'Not yet set.';
fooNamespace.setFoo = function(bar)
{
fooNamespace.foo=bar;
}