From b6e937e8778307077256f65bb73eec1650e91af1 Mon Sep 17 00:00:00 2001 From: euzuro Date: Thu, 20 Jul 2006 13:46:33 +0000 Subject: [PATCH] add addScript() function for loading JSON scripts (or any scripts, for that matter) git-svn-id: http://svn.openlayers.org/trunk/openlayers@984 dc9f47b5-9b13-0410-9fdd-eb0c1a62fdaf --- lib/OpenLayers/Ajax.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/lib/OpenLayers/Ajax.js b/lib/OpenLayers/Ajax.js index efd93c6bb6..e17333d8d3 100644 --- a/lib/OpenLayers/Ajax.js +++ b/lib/OpenLayers/Ajax.js @@ -106,3 +106,13 @@ OpenLayers.parseXMLString = function(text) { return ajaxResponse; }; + +/** + * @param {String} url + */ +OpenLayers.addScript = function(url) { + var head = document.getElementsByTagName("HEAD")[0]; + var scriptElem = document.createElement("script"); + scriptElem.src = url; + head.appendChild(scriptElem); +}; \ No newline at end of file