#include statement for javascript

The Prototype #include statement:

	function include (jsFile) {
		new Ajax.Request(jsFile, {
		  method: 'get',
		  asynchronous  :	false,
		  onSuccess: function(transport) {

			// Evaluate the javascript
			eval(transport.responseText);
		  },
		  onFailure : function() {
			alert("Failure including file: " + jsFile);
		  }
		});
	}
		

The javascript file I'm including:

hello.js

	sayhello = function () {
		alert("I'm saying hello!");
	}
		

Using the include statement:

		include('hello.js');
		sayhello();